displaying multiple variables in one textbox or caption

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • robertlawblaw
    New Member
    • Nov 2006
    • 2

    displaying multiple variables in one textbox or caption

    Is it possible to display more than one variable (one after another on the same line) in a text box or list box or label caption?? Having difficulty with this one... thank you.
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    Originally posted by robertlawblaw
    Is it possible to display more than one variable (one after another on the same line) in a text box or list box or label caption?? Having difficulty with this one... thank you.
    For a textbox, you need to turn on the .Multiline property.

    Otherwise, there shouldn't be any problem - just concatenate using the & operator. If any further difficulty, try posting your code here.

    Comment

    • robertlawblaw
      New Member
      • Nov 2006
      • 2

      #3
      Originally posted by Killer42
      For a textbox, you need to turn on the .Multiline property.

      Otherwise, there shouldn't be any problem - just concatenate using the & operator. If any further difficulty, try posting your code here.

      Turning multiline works if I want to display variables one under the other... however, I want to display variables one beside the other.

      ex.
      for i = 1 to 10
      txtBox.text= strVariable(i)
      next i

      strVariable is an array that has 10 different values. I want them all to appear one beside the other!! Can't do it so far... is there a way? Thanks for your help.

      Comment

      • mra
        New Member
        • Sep 2006
        • 15

        #4
        Originally posted by robertlawblaw
        Turning multiline works if I want to display variables one under the other... however, I want to display variables one beside the other.

        ex.
        for i = 1 to 10
        txtBox.text= strVariable(i)
        next i

        strVariable is an array that has 10 different values. I want them all to appear one beside the other!! Can't do it so far... is there a way? Thanks for your help.
        hi please try this, if u mean it
        for i = 1 to 10
        txtBox.text= txtBox.text & strVariable(i)
        next i

        Comment

        • Killer42
          Recognized Expert Expert
          • Oct 2006
          • 8429

          #5
          Originally posted by robertlawblaw
          Turning multiline works if I want to display variables one under the other... however, I want to display variables one beside the other.
          Sorry, I should have read your message more carefully. mra's suggestion should do the trick.

          You might also want to insert a space or a vbTab between them, as in...
          Code:
          for i = 1 to 10
            txtBox.text= txtBox.text [B]& vbTab[/B] & strVariable(i)
          next

          Comment

          Working...