Hello World

Learn how to output Hello World using Visual Basic 6 with this Tutorial that Celebrates the CESPage 25th Anniversary

Hello World is the universally recognised first stage of a Tutorial used in every programming language and in this case for Visual Basic 6 but can be done in any version of Visual Basic, this Tutorial is presenting using the original Images and Code.

Step 1

Load Microsoft Visual Basic, then select Standard EXE Project if VB5/6, click on the option then click Open
New Project

Step 2

A Blank Form named Form1 should then appear
Blank Form

Step 3

Then from the Visual Basic Components Menu Select the Command Button Control:
Command Button Control

Step 4

Draw a Command Button on the Form
Form with Command Button

Step 5

Then goto the Properties box and change the Caption property from Command1 to Click Here
Command Button Properties

Step 6

Double Click on the Command Button and type in the Command1_Click() Sub:


MsgBox "Hello World",vbInformation,"Test"
                                    

See Below:

Command Button Click Sub

Step 7

Save the Project, for example prjHelloWorld, into a vacant folder as you have finished the application. Click on Start / Run
Start / Run
This should Start the application
Hello World Running

Step 8

Now Click where it Says Click Here and a Message Box will appear, which will look something like this:
Hello World Message

Step 9

Just Click on Ok and End / Stop
End / Stop

That was your first working Visual Basic Application! Try changing the Text or the Title, which is the last part after the vbInformation remark, or have a go at changing the code and extending it, you can learn a lot from this simple application!