Results 1 to 3 of 3

Thread: [RESOLVED] how would tranfer the words in text1 to list1

  1. #1

    Thread Starter
    Fanatic Member newprogram's Avatar
    Join Date
    Apr 2006
    Location
    in your basement
    Posts
    769

    Resolved [RESOLVED] how would tranfer the words in text1 to list1

    on a command 1_click I want to take all the stuff in text1 and put it in list1
    text1 is a multiline and looks like
    hi
    go
    today
    and so no

    and sould load in list1 the same way
    hi
    go
    today
    and so no
    Live life to the fullest!!

  2. #2
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: how would tranfer the words in text1 to list1

    Code:
    Private Sub Command1_Click()
        Dim strArray() As String
        Dim i As Long
        
        strArray = Split(Text1.Text, vbNewLine)
        With List1
            .Clear
            For i = 0 To UBound(strArray)
                .AddItem strArray(i)
            Next
        End With
        Erase strArray
    End Sub

  3. #3

    Thread Starter
    Fanatic Member newprogram's Avatar
    Join Date
    Apr 2006
    Location
    in your basement
    Posts
    769

    Re: how would tranfer the words in text1 to list1

    That works great thank you !!
    Quote Originally Posted by Ellis Dee
    Code:
    Private Sub Command1_Click()
        Dim strArray() As String
        Dim i As Long
        
        strArray = Split(Text1.Text, vbNewLine)
        With List1
            .Clear
            For i = 0 To UBound(strArray)
                .AddItem strArray(i)
            Next
        End With
        Erase strArray
    End Sub
    Live life to the fullest!!

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