Tuesday, December 11, 2007

How to add event handler to your menu item

How to add event handler to your menu item

Step 1

To add event handler to your menu item, just double click on your menu item. The code window will appear. Then we will provide a simple messagebox when you have click on it as show here.

Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click

MsgBox("Hi, you have just clicked on File->About Menu", MsgBoxStyle.OKOnly, "System Message")

End Sub

Step 2

Then press F5 to run you application.

The output is shown above.

No comments: