Visual Basic hello world

Let’s start from previous tutorial where we have created a simple windows application and have only one form over the whole project. Which looks like :

Step 1 : <adding controls>

Drag a simple button from All Windows Forms > Button to form1 window in the designer workspace. And the form will look like this :

Step 2 : <adding code to controls>

When we have controls placed on form and we need to add some code. we usually double click the button on form to open code windows. and after double click on button we add a message display line to this button as :

Public Class Form1

    ' button click event 
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        MsgBox("Hello world, finally we did it") ' message window will be displayed

    End Sub
End Class

now we have to click Debug > Start Debugging or we can also click F5 to start debugging and the output will be displayed as: