Question How can I determine which object caused handler execution?

asegal0000

Member
Joined
May 12, 2009
Messages
5
Programming Experience
10+
I want to have many objects share a common handler.
However, I need to determine which object caused the handler to execute
How can I do that?

private sub CreateObjects

for x = 0 to 99
TB = New TextBox
TB.tabindex=x
Me.Controls.Add(TB)
AddHandler TB.TextChanged, AddressOf CellChanged
next x

end sub

Private Sub CellChanged()

'''' HOW DO I SEE WHICH OBJECT (current text or tab index) had text changed?

end sub
 
Use the event handler definition here instead: Control.TextChanged Event (System.Windows.Forms)
You can also have VS generate an event handler for you, to get the method definition.
'sender' parameter is the object that raised the event.
 
Back
Top