I have a datagrid and 2 textboxes that all trigger the same Leave event. Now I would like to know which tool got me into the event. When I check the value of *sender*, it is System.Windows.Forms.Textbox, and the .Text value of the textbox if there is one.
Is there a way to get the exact senders name, like TextBox1, or dataGrid1?
Events and sender object
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

AlanRank #669 · 3.6K reputationPosted Jun 14, 2007, 1:57 PM EDT
string name = ((Control)sender).Name;
Bevan Shervey10 reputationPosted Jun 21, 2007, 12:28 PM EDT