I want a variable to be expressed in the caption of a label. Is this sort of right?
I'm a bit shady using variables and text together.Code:Private Sub Label1_Load()
Dim nom As String
.Caption = "Who do you want to play as" & nom
End Sub
Cheers
Printable View
I want a variable to be expressed in the caption of a label. Is this sort of right?
I'm a bit shady using variables and text together.Code:Private Sub Label1_Load()
Dim nom As String
.Caption = "Who do you want to play as" & nom
End Sub
Cheers
There are a lot of things wrong with your code but more importantly, could you try again to explain what is it that you are trying to do?
You are declaring a variable without assigning a vlaue to it so your label caption is not going to shaow any value for the var.
Ah, whoops. I should have mentioned this. Some text was taken from a form and put into a variable, then publically declared in a module. In a different form (this one) I want a label to display some text and that specific variable. Once the variable is public what do I have to do to use it? I have to declare it don't I? Sorry for not making much sense before, hope I uh... cleared things up?
The below one is in a module:
Code inside First form:Code:Public strData as string
Code inside Second Form:Code:Private sub command1_click()
strData="Data from first form"
end sub
Something like this????:)Code:Private sub form_load()
Me.caption=strData
end sub
-Best wishes:thumb:
Akhilesh
I think I have an idea...
Module:
Code:Public strData as string
Form1:
When you pressed the command button, the thing that you text box will come out in the label box along with the question..Code:
Private Sub Command1_Click()
strData = Text1.Text
Label1.Caption = "Whom do you want to play as " & strData & "?"
End Sub
Is this suppose to be the output?
Hahah! Both of you are awesome, thanks for clearing the Public stuff up akhileshbc, thats pretty much what I had, but I just got confused.
Louvelle - Thanks, thats exactly what i need, I just couldn't remember that little bit at the end.
Thank you both!
If your problem is solved, then mark the thread as RESOLVED:)
-Bye:)
A friend of mine made a game that does like that...
Your welcome... :bigyello: