Picture
Picture
This example i will show you how you can display a message box when
you click on the button.
This is just a example that will show you how to fire a action when the
button is clicked at runtime.
  • Drag a Button on to your form
  • The code should look like this


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


    End Sub


  • Inside the Button1_Click event type in the following code

MsgBox("You just clicked the button...over there", MsgBoxStyle.Information, Title:="Congradulations")

  • The full code should look like this


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        MsgBox("You just clicked the button...over there", MsgBoxStyle.Information, Title:="Congradulations")
    End Sub


Go a head and run your application by pressing F5 on your keyboard and click the little green play button at the top menu.
If you click the button you will notice the message box displays "You just clicked the button...over there"