[Mono-winforms-list] Generic event handler in C#

Jonathan Pobst monkey at jpobst.com
Tue Sep 9 09:48:21 EDT 2008


You generally give them names, like this:
myUpDown1.Name = "myUpDown1";

then you can distinguish them like this:
if ((sender as UpDownControl).Name == "myUpDown1")
  ...

Jonathan


Paul wrote:
> Hi,
> 
> I have (say) 6 number up/down widgets on a winform. Is there a way for
> me to have one up/down event but in the event handler to be able to know
> which up/down has been pressed?
> 
> I know sender.ToString() will tell me what has been clicked, but that's
> not really much use when dealing with up/down widgets.
> 
> TTFN
> 
> Paul
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Mono-winforms-list maillist  -  Mono-winforms-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-winforms-list



More information about the Mono-winforms-list mailing list