Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to disable menu appearing when right click on datagrid? 2

Status
Not open for further replies.

todd666

IS-IT--Management
Dec 3, 2001
61
CA
Hi,

I have a datagrid. When I press the rigth button of the mouse in the area of the scroll bar of the datagrid a menu is appearing.

How can I prevent this menu appearing?

Thank you.




 
You will have to do more subclassing. Unfortunately I am not at a position to provide a working example at the moment. I believe that we've discussed this before (maybe for a text box??). Do a keyword search.
 
You can sorta cheat

Define a menu item with a blank caption
Name it "mnuIgnore" (or whatever)
Make it invisible

in the MouseDown event for the control
Code:
On Error Resume Next
If Button = vbRightButton Then PopupMenu mnuIgnore
Attempting to Pop Up a menu with no sub-menus generates an error that you just throw away. No menu appears and, because it's invisible, it doesn't appear on the menu bar.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top