My First VB.Net Application (Hello World Example)

In this tutorial, we'll help you create your first Application in VB.Net. In most programming language this is the most commonly used example when writing the first program. To narrow it down, we'll create a simple application that will display a message box saying "Hello World".

Follow the steps below:

1) On the Visual Basic 2010 Express start up window, Open the File Menu then Select New Project. Or Press Ctrl+N.

2) The following window will then pop up. In the Applications type, choose Windows Forms Applications. And type the desired name of your application in the name box, in this example we put "My First Application". Then click OK.

3) When the project is successfully created, Add a Button control on to the Form.

4) Now, double click the Button control and you will see the Code Editor window which already has the Click event of the button control automatically added. Update the code to exactly look as below.
Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        MessageBox.Show("Hello World!")
    End Sub
End Class
5) Press F5 to compile and run the program. You can now see the form.

6) Click the Button on the form and you will surely smile of the message as you have finally created your first VB.Net application.

0 comments: