by Adam Kachwalla (3 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 31st January 2004
Date Added: Mon 8th February 2021
Rating:
(1 Votes)
This example will teach you how to create a Shortcut Menu using 2 Forms. You right-click on Form1 and the menu appears! Ideal for beginners.
API Declarations
'You will need only 2 forms to use this example.
'Form2 is the menu. Make sure there is no Caption and no ControlBox on Form2.
'If you don't want your menu to be resized, set the BorderStyle of Form2 to 3.
'If you have these, you will end up with a dialog instead of a menu!
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then
Form2.Show
Form2.Left = X
Form2.Top = Y
Else: Form2.Hide
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Unload Form2
End Sub
'Paste this code to Form2
Private Sub Form_Click()
Unload Form2
End Sub
No comments have been posted about This example will teach you how to create a Shortcut Menu using 2 Forms. You right-click on Form1 a. Why not be the first to post a comment about This example will teach you how to create a Shortcut Menu using 2 Forms. You right-click on Form1 a.