Forch
Tue Jan 04 09:03:08 CST 2005
Thanks Carlos! That is exactly what I am looking for.
Cheers,
Forch
"Carlos J. Quintero [.NET MVP]" wrote:
> Yes, you have to use the Sender parameter:
>
> Private Sub Button_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Button1.Click, Button2.Click
>
> If sender Is Button1 Then
> Me.Text = "You clicked Button1"
> ElseIf sender Is Button2 Then
> Me.Text = "You clicked Button2"
> End If
>
> End Sub
> --
>
> Carlos J. Quintero
>
> MZ-Tools 4.0: Productivity add-ins for Visual Studio .NET
> You can code, design and document much faster.
>
http://www.mztools.com
>
>
> "Forch" <Forch@discussions.microsoft.com> escribió en el mensaje
> news:8557EED3-A42B-40BD-A33E-8435BAFF9D73@microsoft.com...
> > Hello everyone...
> >
> > I have 4 buttons (Button_1, Button_2, etc...), and I want to call the same
> > method regardless of which button is being clicked.
> >
> > Once I am in the event, how do I know which button was pressed? Or do I
> > have to call a separte method for each button? Or is there magic with
> > "Sender as system.object" ?
> >
> > Thanks,
> >
> > Forch
>
>
>