Event Handler Issue

  • Thread starter Thread starter kthulu
  • Start date Start date
K

kthulu

Greetings All :)

I've just started working on a project with .NET Compact Framework.

Does this newsgroup have a FAQ?

I have a generic VB question.

The code below is a standard evernt handling routine, it responds to both
Button1.Click & Button2.Click events.
Once inside the routine how do I determine the Source of the event?

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click, Button2.Click

End Sub

I'm guessing it is one of the propertys or methods of sender.GetType.???? or
e.GetType.????

Any ideas?

Thanks,

Wayne
 
* "kthulu said:
I've just started working on a project with .NET Compact Framework.

Does this newsgroup have a FAQ?

I have a generic VB question.

The code below is a standard evernt handling routine, it responds to both
Button1.Click & Button2.Click events.
Once inside the routine how do I determine the Source of the event?

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click, Button2.Click

\\\
If sender Is Me.Button1 Then
...
ElseIf sender Is Me.Button2 Then
...
End If
 
Hi Wayne,

The sender gives you access the control that triggered the
response. You can use any property of the sender(name
comes to mind) to find out who triggered the event.

Regards,
Anand
VB.NET MVP
http://manand.typepad.com
 
Back
Top