chitika

Tuesday, September 13, 2011

vb: how to create popup, right click menu?

This site provides users with the information about vb, visual basic, vb6, create popup menu, create right click menu, how to create popup menu, how to create right click menu, and more.

If you think that this site is helpful, please recommend your friends to visit our site.


How to create popup, right click menu in vb?

The following is the code and steps to create popup, right click menu in vb:


--------------------------------------------------------------------------------
1. Create menu-options

- Switch to Design if not

- choose Tools/Menu Editor

- make a option:
caption = Find
name = nmuFind
visible = False

- make some sub-options:
caption = &Find
name = mnuFind
index = 1
caption = &Test
name = mnuTest
index = 2

- click On OK

2. Add the code

- view code of the form
- choose For Object = mnuFind
- add the following code:

Private Sub mnuFind_Click(Index As Integer)
MsgBox "this is find"
End Sub

- choose For Object = mnuTest
- add the following code:

Private Sub mnuTest_Click(Index As Integer)
MsgBox "this is test"
End Sub

3. Make the popup happen

- add the following code in the MouseDown Event

Private Sub Form_MouseDown(Button As Integer,
Shift As Integer, X As Single, Y As Single)
If Button = 2 Then Me.PopupMenu File
End Sub

4. press F5 and test it by right clicking on form

No comments:

Post a Comment

For other hundreds of computer repair tips, tricks, tweaks, guide, help, please go to


http://website.edusoftmax.com