Hello Custom

Learn how to output a Message Box using Visual Basic 6 with this Tutorial that Celebrates the CESPage 25th Anniversary

Please follow all the Steps of Hello World before starting this Tutorial, this Tutorial is presenting using the original Images and Code.

Step 1

After following the Steps from Hello World then will havce the following Form
Hello World Form

Step 2

Then from the Visual Basic Components Menu Select the Text Box Control
Text Box Control

Step 3

Draw a Text Box on the Form
Form with Command Button and Text Box

Step 4

Then go to the Properties box and change the Text property from Text1 to Hello World!
Text Box Properties

Step 5

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


MsgBox Text1.Text,vbInformation,"Test"
                                    

See Below:

Command Button with Text Box Click Sub

Step 6

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

Step 7

Now Click where it Says Click Here and a Message Box will appear
Hello World Message

Just Click on Ok and enter anything you want into the Text Box that is made up of Letters or Numbers and then Click on the Command Button. The Message Box Creates the Text from the Text Box, try it for yourself! Try changing some of the variables, such as seeing if you can get it to display input from two Text Boxes. Clue:Use something like: MsgBox Text1.Text & Text2.Text, vbInformation, "Two Text Boxes"

Step 8

Just Click on Ok and End / Stop
End / Stop