By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,417 Members | 904 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,417 IT Pros & Developers. It's quick & easy.

Multiple Handles clause: which control fired the event?

P: n/a
I have one control DoubleClick event that handles the DoubleClick events for
multiple controls. The .Tag property contains a different string value in
each control that I would like to examine. How can I get the .Tag property
value no matter which control was double clicked? Reflection?

Thanks,
Dean S
Nov 12 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Dean Slindee" <sl*****@charter.netwrote in
news:WU**************@newsfe02.lga:
I have one control DoubleClick event that handles the DoubleClick
events for multiple controls. The .Tag property contains a different
string value in each control that I would like to examine. How can I
get the .Tag property value no matter which control was double
clicked? Reflection?

You can retrieve the original control via the "Sender" parameter.
Nov 12 '06 #2

P: n/a

Dean Slindee wrote:
I have one control DoubleClick event that handles the DoubleClick events for
multiple controls. The .Tag property contains a different string value in
each control that I would like to examine. How can I get the .Tag property
value no matter which control was double clicked? Reflection?

Thanks,
Dean S
You don't need reflection, you can just cast the sender paramter to
control, and then you will have access to the Tag property:

Private Sub DoubleClick (ByVal sender As Object, ByVal e As EventArgs)
Dim ctrl As Control = DirectCast (sender, Control)
Dim stringValue As String = DirectCast (ctrl.Tag, String)

' Do stuff with stringValue
End Sub

Nov 12 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.