Hello ....

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.

www.cespage.com/vb/vbdntut2.html

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:

Hello World

Step 2

Then from the Windows Forms components tab select the Textbox control:

Text Component

Step 3

Draw a Textbox on the Form, see below:

Form1 with Button and Textbox

Step 4

Then goto the Properties box and change the Text property from Textbox1 to Hello World!, see below:

Textbox Properties

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:

Button Click Event with Text

Step 6

Save the Project as you have now finished the application, select Release and Click on Start:

Start (Release)

When you do the following will appear:

Application Running

Step 7

Now click where it says "Click Here" and a Message Box will appear looking something like this:

Hello World

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 Close on the top right of Form1 to end the application.