ITSourceCode.com

We Exist to Provide 100% Free Source Code and Tutorials

Custom Search

02-Hello World

Let’s begin with your first project and that is the “Hello World” application. “Hello World” is the most popular source code that is being run and familiarized by many programmers.

 

Now, Let’s get started.

 

Launch your Visual Basic and create a new project from the File Menu.

01_helloworld

The dialog box will open and it will look like this.

01_helloworld2

Select “Windows” under the Project Types. Then, select “Windows Form Application” under the Templates. After that, type the name of the project “HelloWorld” and hit the button “OK”.

Now, your project will look like this.

01_helloworld3

In the toolbox, select a Button and drag it in the Form. In the properties select “Text” and type “Click Me”.

01_helloworld4

Double click the Button to open the code view  as shown below.

  1. Public Class Form1
  2.  
  3. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  4.  
  5. End Sub
  6. End Class

Do this code inside the click event of the Button.

  1. MsgBox("Hello World")

The code that you have created will look like this.

  1. Public Class Form1
  2.  
  3. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  4. MsgBox("Hello World")
  5. End Sub
  6. End Class

Press F5 to run your project and click the button to fire your code in the method.

01_helloworld5

Facebook Comments

Check Your Domain Ranking

Leave a Reply

Your email address will not be published. Required fields are marked *

ITSourceCode.com © 2016 Frontier Theme

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!