Object in Panel not realizing new values?

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
 
J

jw56578

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?
 
E

Eliyahu Goldin

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

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top