Results 1 to 3 of 3

Thread: Concatenate with spacing

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2000
    How do you concatenate two strings into a list box with spaces between the concatenation. IE, I want to put two string values together using a loop function. Each time it loops it concatenates the two stings and displays them in a list box. Is there something I can use to make the two strings equi-distant apart giving a table-look? Thanks...

  2. #2
    You can use the Split function and put the string(s) into an array to do this.

    Private Sub Command1_Click()
        Dim vArrayName As Variant
        Dim strArrName As String
        Dim intIndex As Integer
        TheString = "Hello World"
        vArrayName = Split(TheString, " ")
        For intIndex = 0 To UBound(vArrayName)
            strArrName = strArrName & vArrayName(intIndex) & vbTab
        Next intIndex
        MsgBox strArrName
    End Sub

  3. #3
    Junior Member
    Join Date
    Oct 2000
    You could try this:
    listbox.additem string1 & space(30 - len(string1)) & string2
    Paul Bousa

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