Home » Controls » How to add Pop Up menu to Text Box Control
How to add Pop Up menu to Text Box Control
Posted on January 5, 2009
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 'Controls - How to add Pop Up menu to Text Box Control Option Explicit 'Add a Text Box to your form. Add a Menu (Name it MyMenu) and at least one Sub Menu. Private Const WM_RBUTTONDOWN = &H204 Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, _ ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Public Sub OpenContextMenu(FormName As Form, MenuName As Menu) Call SendMessage(FormName.hwnd, WM_RBUTTONDOWN, 0, 0&) FormName.PopupMenu MenuName End Sub Private Sub Text1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = vbRightButton Then Call OpenContextMenu(Me, Me.MyMenu) End Sub |
Related posts:
- How to add PopUp Menu to TreeView
- How to check on which word the Mouse hover in Rich Text Box
- How to scan List Box for the text in TextBox
- How to set Text Box Left and Right Margins
- How to Paste the Picture from PictureBox/Clipboard to Rich Text Box
- How to show custom popup menu in a text box
- How to insert a picture into Rich Text box
- How to count number of lines in a Text box
- How to set List View Text Background Color
- How to select the text in a textbox and send it to the clipoard.
Enjoy this article?
Filed under: Controls
Leave a comment
Sponsors
Sponsors
Link Back to us
Donations
If you are benefited from this site, please donate a small contribution to us. It will help to maintain this site better.








