|
|
Title | Initialize a ComboBox using values from a TextBox with the Split command |
Keywords | ListItem, list, ComboBox, TextBox, add, Split |
Categories | Controls |
|
|
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
|
|
|
|
|
|