Now I'm doing this WITHOUT databinding the dataset to the listbox, although it was very simple and displayed everything perfectly with templates it resulted in some major headaches in the fact that you seem to lose alot of control over the databound itemcontrol E.g You cant remove an item from listbox1 after it is added to listbox2 without errors while using itemsource etc...
After much thought and research I've come up with the following...
Using a for each loop I'm copying the data from the dataset and adding that into the Items collection of the listbox itself. Its a simple solution that seems to give me less headaches and seems more inline with what I need for the program.
Now to my problem...
When I use the code below it seems to only show "Sytem.data.datarow" in the listbox (I'm guessing its because that row is holding 3 columns and the listbox doesnt know how to display it correctly.
Dim i As Integer = 0
Dim datarow As DataRow
For Each datarow In ds.Tables(0).Rows
lbox1.Items.Add(ds.Tables(0).Rows(i).ToString)
i += 1
Next
The only way I can get it to partially work is by specifically calling an item index to dispay instead as in the code below but I need all 3 columns to show in my listbox, not just the ItemNames.
Dim i As Integer = 0
Dim datarow As DataRow
For Each datarow In ds.Tables(0).Rows
lbox1.Items.Add(ds.Tables(0).Rows(i).Item(0).ToString)
i += 1
Next
So my question is this how can I programatically move all my dataset info into my listbox without binding, I am also planning on using item templates to show the 3 column data in a custom way as i did before when I was binding to the dataset, but I need the dataset content in my listbox first.
Thanks for your help in advance.

New Topic/Question
Reply



MultiQuote




|