joseph_tom

joseph_tom

  • NA
  • 11
  • 0

How to display the senders detail inside a handler??

Feb 17 2005 3:48 AM
Hi, Let me describe the situation. I have two buttons B1 and B2 and one method named Clicks with two parameters, one of object type and the other is System.Eventargs type. Function definition: public void Clicks(object sender,System.Eventargs e) { } I am associating this method to the click event of B1 and B2 so that method Clicks will handle the click event of both the buttons. Code: this.B1.Click+= new EventHandler(Clicks); this.B2.Click+= new EventHandler(Clicks); Since this is the case, how can I identify which button triggered the event? That is, I want to display a message box inside the Clicks method to display the name of the button that triggered the click event which is in turn handled by the Clicks method. Please help me in doing this. Thanks in advance Rajesh

Answers (2)