Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Need help. Displaying variables inside of a label


ghost's Avatar
0 0

Hey guys,

Im new to vb so i just have a question to ask

I was just wondering how i can display a variable in a label.

I have put the script on the command buttin trying these to show the variable but none hav them have worked

markupI tried Label2.Caption = c

And

markupLabel3 = e

But none of them have done anything all i get is

'Caption' is not a member of 'System.Windows.Forms.Label'

Cheers,


Mr_Cheese's Avatar
0 1

first off, make sure you have the right name for the label.

secondly, make sure you Dim the variable.

Dim word As String

word = "new label caption!!"

Label1.Caption = word


ghost's Avatar
0 0

I have


Mr_Cheese's Avatar
0 1

what version of VB are you using?


ghost's Avatar
0 0

vb.net


ghost's Avatar
0 0

I don't have that much of experience working with vb.net and i don't like it but i think in vb.net it's not like "Label1.caption" anymore, i think it's changed to sth like "Label1.text" just like a textbox. again, i'm not sure but try it and see if it works ;)

GreyFox