|
-
Sep 9th, 2008, 01:04 AM
#1
Thread Starter
New Member
[RESOLVED] Label Properties
I want a variable to be expressed in the caption of a label. Is this sort of right?
Code:
Private Sub Label1_Load()
Dim nom As String
.Caption = "Who do you want to play as" & nom
End Sub
I'm a bit shady using variables and text together.
Cheers
-
Sep 9th, 2008, 01:34 AM
#2
Re: Label Properties
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?
-
Sep 9th, 2008, 02:03 AM
#3
Re: Label Properties
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.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Sep 9th, 2008, 03:30 AM
#4
Thread Starter
New Member
Re: Label Properties
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?
-
Sep 9th, 2008, 04:21 AM
#5
Re: Label Properties
The below one is in a module:
Code:
Public strData as string
Code inside First form:
Code:
Private sub command1_click()
strData="Data from first form"
end sub
Code inside Second Form:
Code:
Private sub form_load()
Me.caption=strData
end sub
Something like this????
-Best wishes
Akhilesh
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Sep 9th, 2008, 04:32 AM
#6
Re: Label Properties
I think I have an idea...
Module:
Code:
Public strData as string
Form1:
Code:
Private Sub Command1_Click()
strData = Text1.Text
Label1.Caption = "Whom do you want to play as " & strData & "?"
End Sub
When you pressed the command button, the thing that you text box will come out in the label box along with the question..
Is this suppose to be the output?
Manny Pacquiao once posted in his twitter:
It doesn't matter if the grammar is wrong, what matter is that you get the message
-
Sep 9th, 2008, 04:37 AM
#7
Thread Starter
New Member
Re: Label Properties
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!
-
Sep 9th, 2008, 04:50 AM
#8
Re: Label Properties
If your problem is solved, then mark the thread as RESOLVED
-Bye
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Sep 9th, 2008, 04:58 AM
#9
Re: [RESOLVED] Label Properties
A friend of mine made a game that does like that...
Your welcome...
Manny Pacquiao once posted in his twitter:
It doesn't matter if the grammar is wrong, what matter is that you get the message
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|