Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleInitialize a ComboBox using values from a TextBox with the Split command
KeywordsListItem, list, ComboBox, TextBox, add, Split
CategoriesControls
 
Use Split to break the text into lines and add each non-blank line to the ComboBox.
 
Private Sub Command1_Click()
Dim entries As Variant
Dim i As Integer

    Combo1.Clear
    entries = Split(Text1.Text, vbCrLf)
    For i = LBound(entries) To UBound(entries)
        If Len(entries(i)) > 0 Then
            Combo1.AddItem entries(i)
        End If
    Next i

    Text1.Text = ""
    Combo1.ListIndex = 0
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated