I want to export data from a listbox,
Listbox1.AddRow "001", "Orange", "1.00","Arief" Listbox1.AddRow "001", "Apple", "1.00","Arief" Listbox1.AddRow "001", "Banana", "1.00","Arief" Listbox1.AddRow "004", "Orange", "1.00","Arief" Listbox1.AddRow "005", "Apple", "1.00","Brandon" Listbox1.AddRow "006", "Banana", "1.00","Brenda" 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) Last_first_word=Listbox1.Cell(row,0) else tisx.WriteLine listBox1.cell(row,1)+" "+listBox1.cell(row,2) end if next tisx.Close
I want to categorized all the items which is has the same code,and put the name at the last. How to make the result like ,
001 Orange 1.00 Apple 1.00 Banana 1.00 Arief 004 Orange 1.00 Arief 005 Apple 1.00 Brandon 006 Banana 1.00 Brenda
Thanks
Regards,
Arief
You'll need to also save the name so you can display it before you move onto a new group of data. Only a minor tweak to your code was needed:
The data has to be sorted by that group number in order for this to work.