control only. It will be applicable to all the events of all the controls.
method and switch case for event names.
"Andrew Robinson" <nemoby@nospam.nospam> wrote in message
news:Oi$UnCR9FHA.3660@TK2MSFTNGP09.phx.gbl...
> Mahesh ,
>
> I agree with what Herfried and Marina have written with regards to
different
> controls of different types.
>
> The one place where I do find it useful to use a single event handler for
> multiple controls is with Button Controls. Take a look at the Button
Command
> event. You can pass different CommandName and CommandArgument strings for
> each button while using the same Button Command event handler.
>
> This works with traditional Button controls as well as Link Buttons and
> Image Buttons.
>
> --
>
> Andrew Robinson
>
www.binaryocean.com >
www.bellinghamdotnet.org >
>
> "Mahesh Devjibhai Dhola [MVP]" <dholamahesh@hotmail.com> wrote in message
> news:uL$KN7P9FHA.2832@TK2MSFTNGP14.phx.gbl...
> Hi,
> I have added few of the events in some control, example code is:
> btnControl.GotFocus +=new EventHandler(EventHandlingMethod);
> btnControl.Click +=new EventHandler(EventHandlingMethod);
> lblControl.Click +=new EventHandler(EventHandlingMethod);
> private void EventHandlingMethod(object sender, EventArgs e)
> {
> .......
> }
> btnControl = Button object, lblControl = Lable object
> Now the problem is: I am adding the same event handler method in all
events
> for btnControl and lblControl too.
> now in EventHandlingMethod method, i can find which control is using
sender
> but now if i want to put some switch cases in the method for Event Name
then
> I have no any such information in the eventargs or anyother way....
> Can someone help/guide me to get the event name?
> Is it possible? if yes then how? If no, then any work around?
> Thanks in Advance
> Regards,
> Mahesh Devjibhai Dhola
>
>