Results 1 to 5 of 5

Thread: Label To Display User Name

  1. #1

    Thread Starter
    Lively Member Jamiex's Avatar
    Join Date
    Sep 2007
    Location
    Scotland, UK
    Posts
    116

    Label To Display User Name

    Hi

    I have a textbox on one of my forms that has to remember the name the user enters. Then on another form it has to display the name the user entered on a label. I tried but have failed so i was wondering if anybody could help.


    Thanks

    Jamie

  2. #2
    Addicted Member Vanasha's Avatar
    Join Date
    Jun 2007
    Location
    In a bin.>_>
    Posts
    152

    Re: Label To Display User Name

    Code:
    Private Sub Text1_Change()
    Form2.Label1.Caption = Text1.Text
    End Sub
    Something like this?
    Quote Originally Posted by Vanasha
    Sorry, i'm slow.


  3. #3
    Hyperactive Member
    Join Date
    Jan 2007
    Posts
    307

    Re: Label To Display User Name

    Well this isnt anything fancy.

    But lets say on form1 you have your textbox.
    On a button click i put

    Form2.Label1 = Text1.Text
    Form2.Show

    Form2 with my label pops up with the name.

    Probably better ways,, some way of storing it in a variable in a class.
    But that looks basic to me.

    Quote Originally Posted by Jamiex
    Hi

    I have a textbox on one of my forms that has to remember the name the user enters. Then on another form it has to display the name the user entered on a label. I tried but have failed so i was wondering if anybody could help.


    Thanks

    Jamie

  4. #4
    Addicted Member
    Join Date
    Oct 2006
    Location
    In the midst of corn, cotton, and beans
    Posts
    185

    Re: Label To Display User Name

    You could store the label caption in a variable in a module

    in Form1

    call StoreInModule(label1.caption)

    in Module

    dim StoreTxt as string

    Public sub StoreInModule(LblTxt as string)
    StoreTxt = LblTxt
    end sub

    Public Function GetFromModule() as string
    GetFromModule = StoreTxt
    EndFunction


    in Form2

    Label2.caption = GetFromModule

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Label To Display User Name

    Just store the username in a public variable in a module and you can us it on any form in your project.

    How are you getting the username?

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