Click here to Skip to main content
15,902,299 members
Home / Discussions / Windows Forms
   

Windows Forms

 
GeneralRe: Reading Word Document Using OLEDB provider Pin
Dave Kreskowiak22-Jun-07 10:19
mveDave Kreskowiak22-Jun-07 10:19 
QuestionOpen cash drawer using c#.net 2.0 Pin
eccw21-Jun-07 19:50
eccw21-Jun-07 19:50 
AnswerRe: Open cash drawer using c#.net 2.0 Pin
originSH21-Jun-07 23:20
originSH21-Jun-07 23:20 
GeneralRe: Open cash drawer using c#.net 2.0 Pin
eccw22-Jun-07 0:03
eccw22-Jun-07 0:03 
GeneralRe: Open cash drawer using c#.net 2.0 Pin
originSH22-Jun-07 4:52
originSH22-Jun-07 4:52 
GeneralRe: Open cash drawer using c#.net 2.0 Pin
eccw22-Jun-07 16:43
eccw22-Jun-07 16:43 
QuestionWhich button did the mouse click Pin
earlgraham21-Jun-07 11:52
earlgraham21-Jun-07 11:52 
AnswerRe: Which button did the mouse click Pin
Scott Dorman21-Jun-07 18:03
professionalScott Dorman21-Jun-07 18:03 
earlgraham wrote:
I have several mouse buttons that on a mouse click they call the same function, but I need to know which button was pressed.


The sender parameter should hold a reference to the button that caused the event to be raised. You should cast it back to a Button before using it. To follow the psuedocode you have in your question, you would want to make sure each button has a distinguishing name and test the Name property. You could also use the Tag property, but you will still end up doing string comparisons.

What is the reason you have all of the buttons going through the same event handler? If each button does something different you are better off sending them to different event handlers. If there is common code (like logging) that needs to occur, refactor that into a separate method and have each event handler call that method at the appropriate time.

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

GeneralRe: Which button did the mouse click Pin
earlgraham22-Jun-07 10:05
earlgraham22-Jun-07 10:05 
QuestionPopulate Date time picker Pin
ozzyrocsdbn21-Jun-07 4:16
ozzyrocsdbn21-Jun-07 4:16 
Questionhow do i search a value using combo box in vb.net Pin
sathyan_829420-Jun-07 22:13
sathyan_829420-Jun-07 22:13 
QuestionUser-ordered list (C#) Pin
ruanr20-Jun-07 22:06
ruanr20-Jun-07 22:06 
AnswerRe: User-ordered list (C#) Pin
originSH21-Jun-07 0:09
originSH21-Jun-07 0:09 
QuestionGlobal Variable Pin
ozzyrocsdbn20-Jun-07 21:34
ozzyrocsdbn20-Jun-07 21:34 
AnswerRe: Global Variable Pin
Giorgi Dalakishvili20-Jun-07 22:08
mentorGiorgi Dalakishvili20-Jun-07 22:08 
GeneralRe: Global Variable Pin
ozzyrocsdbn20-Jun-07 22:39
ozzyrocsdbn20-Jun-07 22:39 
GeneralRe: Global Variable Pin
Giorgi Dalakishvili20-Jun-07 22:41
mentorGiorgi Dalakishvili20-Jun-07 22:41 
AnswerRe: Global Variable Pin
Brady Kelly20-Jun-07 22:12
Brady Kelly20-Jun-07 22:12 
GeneralRe: Global Variable Pin
ozzyrocsdbn20-Jun-07 22:38
ozzyrocsdbn20-Jun-07 22:38 
GeneralRe: Global Variable Pin
Brady Kelly20-Jun-07 22:46
Brady Kelly20-Jun-07 22:46 
AnswerRe: Global Variable Pin
vims25-Jun-07 21:53
vims25-Jun-07 21:53 
QuestionImport / Export of data from an Excel Sheet Pin
Siddhartha S.20-Jun-07 20:45
Siddhartha S.20-Jun-07 20:45 
QuestionButton control Pin
dodoxor20-Jun-07 20:14
dodoxor20-Jun-07 20:14 
AnswerRe: Button control Pin
Manas Bhardwaj22-Jun-07 5:08
professionalManas Bhardwaj22-Jun-07 5:08 
QuestionRe: Button control Pin
dodoxor22-Jun-07 21:19
dodoxor22-Jun-07 21:19 

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.