Results 1 to 9 of 9

Thread: [RESOLVED] Label Properties

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2008
    Posts
    15

    Resolved [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

  2. #2

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  4. #4

    Thread Starter
    New Member
    Join Date
    Sep 2008
    Posts
    15

    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?

  5. #5
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    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,...

  6. #6
    Fanatic Member louvelle's Avatar
    Join Date
    Jun 2008
    Posts
    513

    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

  7. #7

    Thread Starter
    New Member
    Join Date
    Sep 2008
    Posts
    15

    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!

  8. #8
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    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,...

  9. #9
    Fanatic Member louvelle's Avatar
    Join Date
    Jun 2008
    Posts
    513

    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
  •  



Click Here to Expand Forum to Full Width