Results 1 to 2 of 2

Thread: [RESOLVED] copy textbox into listbox

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2006
    Posts
    101

    Resolved [RESOLVED] copy textbox into listbox

    I have a textbox full of processes like this:

    VB Code:
    1. [System Process]
    2. System
    3. smss.exe
    4. csrss.exe
    5. winlogon.exe
    6. services.exe
    7. svchost.exe
    8. svchost.exe
    9. svchost.exe
    10. Smc.exe
    11. VB6.EXE
    12. firefox.exe

    etc.. I want to loop through it and put it into a listbox.
    Last edited by skankerer; Oct 31st, 2006 at 03:33 AM.

  2. #2
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965

    Re: copy textbox into textbox

    Quote Originally Posted by skankerer
    I have a textbox full of processes like this:

    VB Code:
    1. [System Process]
    2. System
    3. smss.exe
    4. csrss.exe
    5. winlogon.exe
    6. services.exe
    7. svchost.exe
    8. svchost.exe
    9. svchost.exe
    10. Smc.exe
    11. VB6.EXE
    12. firefox.exe

    etc.. I want to loop through it and put it into a listbox.
    Is there a Carrage Return at the end of each item? If so, you can use the SPLIT function to separate them and put them into an array and then you could simply load the listview.

    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Command1_Click()
    4. Dim strText() As String
    5. Dim a As Long
    6.  
    7.     'Split will divide the items in the text box by
    8.     'the vbNewLine Character and put the items into
    9.     'the strText Array
    10.     strText = Split(Text1.Text, vbNewLine)
    11.  
    12.     'This will take every item in the strText Array
    13.     'and add it to the Listbox
    14.     For a = 0 To UBound(strText)
    15.         List1.AddItem strText(a)
    16.     Next a
    17. End Sub
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


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