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

Charlie Poole charlie at nunit.com
Tue Sep 9 13:03:26 EDT 2008


Or just do
  if ( sender.Equals( upDownControl1 ) ) 

> -----Original Message-----
> From: mono-winforms-list-bounces at lists.ximian.com 
> [mailto:mono-winforms-list-bounces at lists.ximian.com] On 
> Behalf Of Jonathan Pobst
> Sent: Tuesday, September 09, 2008 6:48 AM
> To: paul at all-the-johnsons.co.uk
> Cc: winforms
> Subject: Re: [Mono-winforms-list] Generic event handler in C#
> 
> 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
> 
> _______________________________________________
> 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