Categorized Items

Hi All,

I want to categorized items n listbox with criteria,

[code] Listbox1.AddRow “001”, “Orange”, “1.00”,“10%”,“Arief”
Listbox1.AddRow “001”, “Apple”, “1.00”,“10%”,“Arief”
Listbox1.AddRow “001”, “Banana”, “1.00”,“10%”,“Arief”

Listbox1.AddRow “004”, “Orange”, “1.00”,"",“Arief”
Listbox1.AddRow “005”, “Apple”, “1.00”,"",“Brandon”
Listbox1.AddRow “006”, “Banana”, “1.00”,"",“Brenda”

Listbox1.AddRow “007”, “Orange”, “1.00”,"",“Arief”
Listbox1.AddRow “007”, “Apple”, “1.00”,"",“Arief”
Listbox1.AddRow “007”, “Banana”, “1.00”,"",“Arief”

dim f as folderitem
dim tisx as TextOutputStream
f = new folderitem(“item.txt”)
tisx = f.CreateTextFile

dim Last_first_word as String
dim maxRow as Integer = Listbox1.listcount-1
for row as integer = 0 to maxRow
if Listbox1.Cell(row,0)<> Last_first_word then
tisx.WriteLine “”
tisx.writeline listBox1.cell(row,0)
tisx.WriteLine listBox1.cell(row,1)+" “+listBox1.cell(row,2)
tisx.WriteLine listBox1.cell(row,3)
tisx.WriteLine listBox1.cell(row,4)
Last_first_word=Listbox1.Cell(row,0)
else
tisx.WriteLine listBox1.cell(row,1)+” "+listBox1.cell(row,2)
end if

next

tisx.Close
f.Launch[/code]

but the result is not expected.

I wanted to categorized like,
code number
product (listed as long as the code number is the same)
Percentage ( write if the listbox has a value)
Name

but the result is shows like ,

[code]
001
Orange 1.00
10%
Arief
Apple 1.00
Banana 1.00

004
Orange 1.00

Arief

005
Apple 1.00

Brandon

006
Banana 1.00

Brenda

007
Orange 1.00

Arief
Apple 1.00
Banana 1.00[/code]

I am expecting like,

001
Orange 1.00
Apple 1.00
Banana 1.00
10%
Arief

004
Orange 1.00
Arief

005
Apple 1.00
Brandon

006
Banana 1.00
Brenda

007
Orange 1.00
Apple 1.00
Banana 1.00
Arief

any helps ?

thanks
regards,
Arief