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 (51.4KB) Download Source Code (7KB)
Step 1
Load Microsoft Visual Studio.NET, click on File | Open Solution, 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 from Textbox1 to Hello World!, see below:
Step 5
Double Click on the Button Control and change the contents of the Button1_Click Sub to:
MsgBox(Textbox1.Text, MsgBoxStyle.Information, "Test")
See Below:
Step 6
Save the Project as you have now finished the application, select Release and 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 Text1.Text & Text2.Text, vbInformation, "Two Text Boxes")
Click on the Close button on the top right of Form1 to end the application.