VB6 Contents for text into label

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Wernerh
    New Member
    • Jul 2007
    • 104

    VB6 Contents for text into label

    Hi there and a happy new year to all. I have a label and a few text boxes. The label is set to scroll the info from the textboxes. It is easy to link 1 textbox to a label, but I want to label to read from a few textboxes in sequence. and scroll the info from those text boxes.

    Herewith my code:
    frmSplash.Label 50.Caption = Player1.Text1.T ext Then Player1.Text2.T ext

    My problem is how to identify the next "textbox" in the sequence? I have used the Then function as i have no idea what should be used or if it is possible. I have tried "then" "," "next" between the 2 identified textboxes with no luck. Can anyone help please.

    Thanks
    Werner
  • QVeen72
    Recognized Expert Top Contributor
    • Oct 2006
    • 1445

    #2
    Hi,

    Keep an Array which contains names of all the TextBox in a Sequential manner, Say MyArr(0) = "Text1", MyArr(1) = "NewTextBox "..
    And a Form Level Variable, To Check the Current Index.
    So depending on the Index, Set the Next TextBox,
    To Go to Next TextBox :

    [code=vb]
    Dim T1 As TextBox
    MyIndex = MyIndex+1
    If MyIndex >= UBound(MyArr) Then MyIndex =0 'Repeat here
    Set T1 = MyArr(MyIndex). ..
    ' Write here code to populate from T1
    [/code]

    Regards
    Veena

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      Originally posted by Wernerh
      ... frmSplash.Label 50.Caption = Player1.Text1.T ext Then Player1.Text2.T ext

      My problem is how to identify the next "textbox" in the sequence? I have used the Then function as i have no idea what should be used or if it is possible. I have tried "then" "," "next" between the 2 identified textboxes with no luck. Can anyone help please.
      You use "&" or "+" to concatenate them into a single string.

      Then is not a function. It is the part of the If statement which indicates what to run if the condition is true.

      Comment

      • Wernerh
        New Member
        • Jul 2007
        • 104

        #4
        Thanks Killer42, that was the simple answer i was looking for, just another question to that. My result is working perfectly, but obviously now reads like this : MarkJohn How do I indentify spaces example Mark John. Thanks again

        My code :
        frmSplash.Label 50.Caption = Player1.Text1.T ext & Player1.Text2.T ext

        Comment

        • Killer42
          Recognized Expert Expert
          • Oct 2006
          • 8429

          #5
          Just keep in mind, you can use & to concatenate any strings, including spaces or whatever you want.

          Comment

          Working...