I have two different grid controls on the same form. They share the same context menu. I am having trouble determining which control is the owner when I select the context menu item.
Asked
Active
Viewed 4,517 times
2 Answers
6
SourceControl property on the ContextMenuStrip class will show the last control that caused that menu strip to be shown.

Binary Worrier
- 50,774
- 20
- 136
- 184
0
The event handler for the MenuItem's Click event will have a Sender parameter. This object should be the control that had the focus when the context menu was displayed.

Stu Mackellar
- 11,510
- 1
- 38
- 59
-
Sorry but all that will give you is a reference to the actual menu item that was clicked, not the control that was right clicked to fire the context menu. – Binary Worrier Oct 28 '08 at 17:23