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?
 
no. objpanel, still has a reference to the first one.

-- bruce (sqlwork.com)
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top