|
-
Feb 27th, 2006, 06:40 PM
#1
Thread Starter
Member
Context Menu Question
Hey,
Is there a way to capture which control the user executed a context menu from? In order words, if textboxes txtName and txtAddress have the same context menu, is there a way determine which one was clicked in the menuitem click event? The sender parameter is a reference to the actual menuitem and not the control...
-
Feb 27th, 2006, 06:45 PM
#2
Sleep mode
Re: Context Menu Question
As a quick thought , how about using flags in both textboxes !
-
Feb 27th, 2006, 07:05 PM
#3
Re: Context Menu Question
Here's what you do. You want to do something with or to a ContextMenu and/or a MenuItem. You go to the help/MSDN library and you read the help topic for each class to see if it tells you there. If not, then you follow the link to the member listing for the class(es) and you read the descriptions of each member to see if something there seems useful. Following this methodology you find exactly what you need in the SourceControl property of the ContextMenu.
Gets the control that is displaying the shortcut menu.
You can then follow the link for more information on that specific member, which will often incude a code sample. That is the first thing you should do EVERY time you don't know how to do something with or to a specific class. If you don't find what you're looking for you'll probably still learn something from the experience and you can still ask the question on a forum. That's how I've learned about 90 % of what I know about .NET development.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|