Context menus - how to find which control caused open

J

John Google

Hi,

I'm using VS2005 .NET 2.0.

I want to have a single context menu on a form and link it to various
controls via the ContextMenuStrip property of each control. Then I want
to dynamically modify the context menu depending upon which control
caused the context menu to be displayed via the right mouse button..

I've got the code to dynamically modify the menu working OK by hooking
into the contextMenuStrip.Opening event. However, I have not yet found
of a way to determine which control caused the context menu to be
displayed.

Can this be done?

TIA

John.
 
J

John Google

It's OK.

I've found another thread which showed me that ContextMenuStrip has the
SourceControl property. I've just tested it and it works OK.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top