This continues the Hello World example, please follow all the Steps of Hello World before starting this Tutorial or use the Source Code provided and adapt as needed.
Printer Friendly Download Tutorial (64.1KB) Download Source Code (12.8KB)
Step 1
Load Microsoft Visual Basic 2005 Express Edition then select File, Open File and select the Solution file for the first tutorial (e.g HelloWorld.sln) and the following will appear:
Step 2
Then from the Windows Forms components tab select the Textbox control:
Step 3
Draw a Textbox on the Form, see below:
Step 4
Then goto the Properties box and change the Text property to Hello World, see below:
Step 5
Double Click on the Button Control and type in the Button1_Click Sub:
MsgBox(TextBox1.Text, MsgBoxStyle.Information, "Test")
See Below:
Step 6
Save the Project as you have now finished the application, then click on Start:
When you do the following will appear:
Step 7
Now click where it says "Click Here" and a Message Box will appear looking something like this:
Step 8
Click on OK, then enter something different in the textbox at the top of the form and click on the Button again! The message box will now show the text you have entered. 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(Textbox1.Text & Textbox2.Text, vbInformation, "Two Text Boxes")
Click on the Close button on the top right of Form1 to end the application.