Seems simple enough, but there is a twist.........here is the scenario:-
Within the app the user is initially presented with a series of check boxes. Depending on the number of checkboxes selected the number of items in the list box varies. In the example data below two check boxes are selected hence three lines in each "block" as the two items are associated with the master hence three items in each "block". So in my list box I have the following :-
item1 'master item 1
item2 'associated item (checkbox 1)
item3 'associated item (checkbox 2)
------
item4 'master item 2
item5 'associated item (checkbox 1)
item6 'associated item (checkbox 2)
------
etc
The dotted lines are in the listbox contents as a visual device to seperate the master & subitem "blocks". My goal is to obtain the following output :-
item1,item2,item3
item4,item5,item6
etc
etc
Using variations of this code :-
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim i As Integer
w = New IO.StreamWriter("c:\test.txt")
For i = 0 To ListBox1.Items.Count - 1
w.Write(ListBox1.Items.Item(i) & ",")
Next
w.Close()
End Sub
I get :-
Item1,item2,item3,item4,item5,item6,
or
item1,
item2,
item3,
item4,
item5,
item6,
I can't seem to get the output format to provide what I am looking for. Any assistance would be gratefully appreciated.


