invisible = lose all text?

ssfftt

Well-known member
Joined
Oct 27, 2005
Messages
163
Programming Experience
1-3
invisible = lose all value?

i have a lable "lblAAA", which holds a value AAA: lblAAA.text = AAAonce i set its visible= false, and trying to get its pre-set value, e.g.
VB.NET:
msgbox(lblAAA.text)
it gave a NULL value.Is it a bug or I did something wrong? Visible = false should mean it is invisible only at run time, what's to do with its value?
 
IS this the actual code:
VB.NET:
lblAAA.text = AAA

Is AAA a variable or some thing? Or was it supposed to be the literal text "AAA"??
-tg
 
Well if your label was filled with certain value it will keep it until you not get empty manualy or close the form. So, in this case i suspect that you haven't passed value properly as TG said you have to either pass a variable say string that is holder of text or pass a literal (quoted) text
In your case:
lblAAA.Text = "AAA"
now you can make it unvisible but "AAA" will be still there.
 
actually the label has databinding, while i do sqlDataAdapter1.fill(DS1), this label shows the ID (one of the columns of the record, it can be anything, e.g. name, price) of retrieved record. when the lable is set invisible, the value seems lost, but once i set it back to visible, msgbox(lblAAA.text) gives me the expected value. Hope i made myself clear enough, sorry for confusing u guys :)
 
I got it around in a silly way: set the forecolor same as backcolor, so it looks invisible without losing the value, plz dont laugh, it worked though~ :). However, I still expect a perfect solution from u guys, plz
 
Back
Top