How to Get Reference to Sender

  • Thread starter Thread starter Marty Cruise
  • Start date Start date
M

Marty Cruise

I need to create a reference to the sender of an
OnMouseDown event. Here is my code:

Dim myView As New ListView
AddHandler myView.MouseDown, AddressOf viewMousedown

Sub viewMousedown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs)

Dim myListView as Listview

' Now how do I get a reference to the sender so that
I can access its properties (tag, etc)?

End Sub
 
Marty Cruise said:
I need to create a reference to the sender of an
OnMouseDown event. Here is my code:

Dim myView As New ListView
AddHandler myView.MouseDown, AddressOf viewMousedown

Sub viewMousedown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs)

Dim myListView as Listview

' Now how do I get a reference to the sender so that
I can access its properties (tag, etc)?

End Sub

mylistview = directcast(sender, listview)
 
Hello,

Marty Cruise said:
I need to create a reference to the sender of an
OnMouseDown event. Here is my code:

Dim myView As New ListView
AddHandler myView.MouseDown, AddressOf viewMousedown

Sub viewMousedown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs)

\\\
DirectCast(sender, ListView).<...> = <...>
///
 
Back
Top