Right Click Menu

Zardo

New member
Joined
May 12, 2010
Messages
2
Location
Denmark
Programming Experience
1-3
Hi code nerds :)

I am new here and hope that you can help me.

I have created several applications before and my programming skills have become better and better, but now I have a question that I hope you can help me to solve.

My application has a DataGridView with DataGridViewTextBoxes and DataGridViewComboBoxes.

When I enter a textbox cell in the DataGridView the cell enters edit mode as it should, no problem.

My problem is that when I perform a right click with the mouse in the cell, the standard windows right click menu appears. I want my own context menu to appear instead, how can I do that?

I have read a little bit about hookin, SendMessage and several other things, but I could not get any of them to work right.

Is there a way to disable the standard windows right click menu in my application so I can show the user my own?

If you need to see some code, I will show some of it to you

Regards
 
For example for EditingControlShowing event:
VB.NET:
e.Control.ContextMenuStrip = Me.ContextMenuStrip1
 
Wow... thanks JohnH... that worked :)

Very simple...

If I want different ContextMenu's to appear in different colums I guess that I just have to check wich column the user has clicked and then set the e.Control.ContextMenuStrip to the menu that the user has to see... right?

No need to answer, I just tried it, and it worked... thanks again.
 
Last edited:
Yes, you can use for example CurrentCellAddress to see which.
 
Back
Top