Object in Panel not realizing new values?

  • Thread starter Thread starter jw56578
  • Start date Start date
J

jw56578

If i have a label that i add to a panel control collection in page
load.
then in another method i re instantiate the label and assign a
different text property, why doesn't the panel contain the new label
object
 
let me pub a code sample

protected objLabel as Label

sub page_load

objLabel = new Label
objlabel.text ="first text"
objpanel.controls.add(objLabel)
end sub

sub recreateControl
objLabel = new label
objLabel.text = "second text"
end sub

once the "recreateControl" method is called, should the "second text"
be displayed?
 
What you call to "re instantiate" actually means to create another instance
of Label class and assign it to the same pointer. Nothing happens to the old
instance, it is still referenced by another pointer that you put into a
control collection.

Eliyahu
 
Back
Top