Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2002
    Location
    Norway
    Posts
    239

    Unanswered: Changing label caption

    On a form I have a label called ”Label_1”
    I need to change the caption of this label by reffering to it as a created label name.
    (My intention is to change caption for all lables on a form, depending on language)
    I try to use the code below, but it fails.
    Can anyone please help me ?


    Dim MyLabel As Label
    Set MyLabel = "Label_1"
    Me.MyLabel.Caption = "Hello 1"


    thanks,
    sincerely
    Vestigo

  2. #2
    Join Date
    Jan 2004
    Location
    The Netherlands
    Posts
    421
    Why not simply use:

    Me.Label_1.caption = "Hello 1"

    Greetz

  3. #3
    Join Date
    Nov 2002
    Location
    Norway
    Posts
    239

    Red face Solved

    Becaus I need to scan all Lables in the form (Label_#)

    The solution was:

    Dim i as integer
    For i=1 to 20
    Dim strLabel As String
    strLabel = "Label_" & i
    Me(strLabel).Caption = “Hello “ & i
    Next i

    sincerely
    Vestigo

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •