Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
 
 
 
500MB 27GB Web Hosting - $9.95/Month
 
 
 
 
 
Old Pages
 
Old Index
Site Map
What's New
 
Books
How To
Tips & Tricks
Tutorials
Stories
Performance
Essays
Links
Q & A
New in VB6
Free Stuff
Pictures
 
 
 
TitleCopy multi-line text into a ListBox
KeywordsListBox, copy, additem, text, TextBox
CategoriesControls
 
Use InStr to find the vbCrLf characters. Use Left$ and Mid$ to break the text apart and add the lines to the ListBox.
 
Private Sub Command1_Click()
Dim txt As String
Dim pos As Integer

    List1.Clear
    txt = Text1.Text
    Do While Len(txt) > 0
        pos = InStr(txt, vbCrLf)
        If pos = 0 Then
            List1.AddItem txt
            txt = ""
        Else
            List1.AddItem Left$(txt, pos - 1)
            txt = Mid$(txt, pos + Len(vbCrLf))
        End If
    Loop
End Sub
 
Formatted by Neil Crosby
 
 
Copyright © 1997-2003 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated