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/vbextut2.html

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:

Hello World

Step 2

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

Textbox 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 to Hello World, see below:

Textbox Properties

Step 5

Double Click on the Button Control and type in the Button1_Click Sub:

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, then click on Start:

Start

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:

Message Box

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