My problem is very simple, i have 4 columns at the moment, this code is supposed to add the column name, and then the details to a listview. Sounds easy, but what i am getting is that all the row details are being listed in column 1. Can anyone tell me why the rows are not been added to the right column?
Thanks in advanceCode:For i = 0 To ds.Tables("Contacts").Columns.Count - 1 'Loops until all columns have been added 'Stores column name as string strColumnName = ds.Tables("Contacts").Columns.Item(i).ColumnName 'Skip over column ID If strColumnName = "ID" Then Else 'Add Column name to listview lv1.Columns.Add(strColumnName) 'Loop until rows have been added For j = 0 To ds.Tables("Contacts").Rows.Count - 1 'Add Row name to string strRowName = ds.Tables("Contacts").Rows(j).Item(strColumnName).ToString 'Add string to listview lv1.Items.Add(strRowName) Next lv1.Update() End If
Redmo




Reply With Quote