On Fri, 30 May 2008 11:54:35 -0700, eljainc <el*****@sbcglo bal.netwrote:
[...]
Can someone tell me the c# construct to set the Text property of the
"calling" object, in this case a textbox?
You can retrieve the control that caused the context menu to appear using
the ContextMenuStri p.SourceControl property (after getting the
ContextMenuStri p parent from the menu item, of course). Then, just set
the Text property of that Control instance.
Warning: there's a bug in .NET in which the SourceControl property is only
valid for top-level menu items. As long as you don't have sub-menus, this
won't be an issue. If you do, there are work-arounds...a Google search in
this newsgroup will help you find previous comments on that topic.
For what it's worth, your subject and your description of the control as
"the 'calling' object" both seem inaccurate to me, given what appears to
be the actual goal here. You may find that it's easier to get good
answers to your questions if you take care to make sure you've described
the question as simply, and non-prejudicially as possible (on the latter
point, I mean that the inaccurate parts I mentioned seem to be inaccurate
because of a presumption on your part as to what the solution might look
like, rather than simply stating the broader problem being solved).
Of course, I may have misunderstood the question, and if so then my
comments about the accuracy of the question may themselves be inaccurate.
However, even in that case there'd still be a good argument that the
question was ambiguous. :)
Pete