Show messagebox in VB when you click on button


1. Create a new project

2. Add one button from toolbox on the form.

3. Double click on button to open code window and type the following code

 

Private Sub Command1_Click()

MsgBox “welcome”

End Sub

 

4. Add second button on the form.

5. Double click on this button to open code window and type the following code

Private Sub Command2_Click()

MsgBox “bye”

End Sub

 

6.  Press F5 to run

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>