Click here to Skip to main content
15,896,509 members
Home / Discussions / C#
   

C#

 
QuestionHow can i know witch button send me the event ? Pin
Yanshof1-Aug-07 5:32
Yanshof1-Aug-07 5:32 
AnswerRe: How can i know witch button send me the event ? Pin
Tarakeshwar Reddy1-Aug-07 5:38
professionalTarakeshwar Reddy1-Aug-07 5:38 
GeneralRe: How can i know witch button send me the event ? Pin
Yanshof1-Aug-07 5:41
Yanshof1-Aug-07 5:41 
GeneralRe: How can i know witch button send me the event ? Pin
il_masacratore1-Aug-07 5:49
il_masacratore1-Aug-07 5:49 
GeneralRe: How can i know witch button send me the event ? Pin
Martin#1-Aug-07 5:52
Martin#1-Aug-07 5:52 
GeneralThanks Pin
Yanshof1-Aug-07 6:04
Yanshof1-Aug-07 6:04 
GeneralYou are wellcome! Pin
Martin#1-Aug-07 6:15
Martin#1-Aug-07 6:15 
AnswerRe: How can i know witch button send me the event ? Pin
Scott Dorman1-Aug-07 13:32
professionalScott Dorman1-Aug-07 13:32 
You can also check out this thread, which asked almost the same question.
http://www.codeproject.com/script/comments/forums.asp?forumid=387161&Page=3&userid=157870&mode=all&select=2094274&df=100&fr=231.5#xx2094274xx[^]

As others have already pointed out, casting the sender to a Button and then looking at it's properties (name, tag, etc.) to determine which button it is will be the best way to go.

The question that it seems no one asked is why do you need to route 10 buttons through the same event handler? Surely all 10 buttons don't do the same thing? If they actually do different things and you are trying to use 1 event handler to do some common things (like logging, for instance) you would probably be better off to use separate event handlers for each button and then have each event handler call a separate common method.

-----------------------------
In just two days, tomorrow will be yesterday.

http://geekswithblogs.net/sdorman

QuestionDatabase Pin
Xmen Real 1-Aug-07 4:59
professional Xmen Real 1-Aug-07 4:59 
AnswerRe: Database Pin
Pete O'Hanlon1-Aug-07 5:09
mvePete O'Hanlon1-Aug-07 5:09 
AnswerRe: Database Pin
Blue_Boy1-Aug-07 5:11
Blue_Boy1-Aug-07 5:11 
QuestionSerial port and reading HEX(FF) Pin
mn759301-Aug-07 4:56
mn759301-Aug-07 4:56 
AnswerRe: Serial port and reading HEX(FF) Pin
Eike Mueller1-Aug-07 5:45
Eike Mueller1-Aug-07 5:45 
AnswerRe: Serial port and reading HEX(FF) Pin
Luc Pattyn1-Aug-07 5:49
sitebuilderLuc Pattyn1-Aug-07 5:49 
AnswerRe: Serial port and reading HEX(FF) Pin
mn759301-Aug-07 21:49
mn759301-Aug-07 21:49 
Questionproblem with Linq Expressions Pin
Super Lloyd1-Aug-07 4:35
Super Lloyd1-Aug-07 4:35 
QuestionConverting crystal report in to a RDL file Pin
logicaldna1-Aug-07 3:18
logicaldna1-Aug-07 3:18 
AnswerRe: Converting crystal report in to a RDL file Pin
Not Active1-Aug-07 3:46
mentorNot Active1-Aug-07 3:46 
QuestionRe:Flash Player Control for Standalone Application in .Net Pin
kyreddy1-Aug-07 2:40
kyreddy1-Aug-07 2:40 
AnswerRe:Flash Player Control for Standalone Application in .Net Pin
il_masacratore1-Aug-07 2:53
il_masacratore1-Aug-07 2:53 
QuestionWPF Treeview with checkboxes Pin
Johan Lombaard1-Aug-07 2:16
Johan Lombaard1-Aug-07 2:16 
QuestionCannot Delete a File Pin
Mihir Karkare1-Aug-07 2:13
Mihir Karkare1-Aug-07 2:13 
AnswerRe: Cannot Delete a File Pin
Martin#1-Aug-07 2:25
Martin#1-Aug-07 2:25 
AnswerRe: Cannot Delete a File Pin
Luc Pattyn1-Aug-07 2:27
sitebuilderLuc Pattyn1-Aug-07 2:27 
GeneralRe: Cannot Delete a File Pin
Mihir Karkare2-Aug-07 1:06
Mihir Karkare2-Aug-07 1:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.