M
Mark Denardo
Hi I have an app that has a number of textboxes (richtextboxes to be exact)
that get created dynamically and I add a few at a time to panel controls (so
I can flip a group in and out when I want). So the textbox objects get
added to the panel object like so:
panelObj.Controls.Add(textboxObj)
And then I store the panel Objects in a linked list so I can sort through
them later.
Each texbox I create I setup a Handler to trap any time a user leaves the
box like so:
AddHandler tb.Leave, AddressOf CellEvent_Leave
My CellEvent_Leave method looks like so:
Private Sub CellEvent_Leave(ByVal sender As Object, ByVal e As
System.EventArgs)
As I traverse the linked list, I am comparing the Panel Objects I stored
with the sender of the event's parent like so:
If (panelObj Is sender.parent) Then
But this is never evaluating to true, even though I can trace both panelObj
and sender.parent and see I'm looking at the same objects.
I'm thinking this may be some sort of pointer issue. Perhaps there is a
copy being made somewhere. Should I be comparing these in a different way,
or is something wrong in what I'm trying to do. Is there a better way to
trap events on dynamically created controls like I'm doing?
that get created dynamically and I add a few at a time to panel controls (so
I can flip a group in and out when I want). So the textbox objects get
added to the panel object like so:
panelObj.Controls.Add(textboxObj)
And then I store the panel Objects in a linked list so I can sort through
them later.
Each texbox I create I setup a Handler to trap any time a user leaves the
box like so:
AddHandler tb.Leave, AddressOf CellEvent_Leave
My CellEvent_Leave method looks like so:
Private Sub CellEvent_Leave(ByVal sender As Object, ByVal e As
System.EventArgs)
As I traverse the linked list, I am comparing the Panel Objects I stored
with the sender of the event's parent like so:
If (panelObj Is sender.parent) Then
But this is never evaluating to true, even though I can trace both panelObj
and sender.parent and see I'm looking at the same objects.
I'm thinking this may be some sort of pointer issue. Perhaps there is a
copy being made somewhere. Should I be comparing these in a different way,
or is something wrong in what I'm trying to do. Is there a better way to
trap events on dynamically created controls like I'm doing?