Re: fill array from Combobox
Welcome to Forums! :wave:
Would this work for you?
Code:
Private Sub Command1_Click()
Dim i As Integer
Dim arItems() As String
Dim strOutput As String
For i = 0 To Combo1.ListCount - 1
strOutput = strOutput & Combo1.List(i)
If i < Combo1.ListCount Then
strOutput = strOutput & ","
End If
Next i
arItems = Split(strOutput, ",")
Open "c:\test.txt" For Output As #1
For i = 0 To UBound(arItems)
Print #1, Trim(arItems(i))
Next i
Close #1
MsgBox "File's done."
End Sub
Re: fill array from Combobox
Welcome to the forums. :wave:
May I ask why you are using a single column control like a combo box to store multiple columns? This seems more like a job for a grid control or a Listview control.
Re: fill array from Combobox
Listcount is not a member of the combobox, at least not in VB2005, nor is open, Im new to 2005 and am not transitioning well.
Re: fill array from Combobox
Quote:
Originally Posted by joshboski
Listcount is not a member of the combobox, at least not in VB2005, nor is open, Im new to 2005 and am not transitioning well.
Moved to VB.NET
Re: fill array from Combobox
this does what you want
Code:
Using sw As IO.StreamWriter = New IO.StreamWriter("c:\Test.txt")
For Each Item As String In ComboBox1.Items
Dim tmp() As String = Item.Split(",")
For Each SplittedString As String In tmp
sw.WriteLine(SplittedString.Trim)
Next
Next
End Using