G
GTi
I have a detailed view listbox with 4 colums.
I have found out a way to add rows, but is
this the correct way of doing this?
Where do I put a uniqe value to a row.
(listViewItem.Tag = UniqeRowID)
This is NOT the index number, but my own ID.
string[] s=new string[10]; // extra spare
s[0] = "Data Col 1";
s[1] = "Data Col 2";
s[2] = "Data Col 3";
s[3] = "Data Col 4";
System.Windows.Forms.ListViewItem listViewItem = new ListViewItem(s);
listViewItem.Tag = UniqeRowID;
this.listView1.Items.AddRange(new ListViewItem[] {listViewItem} );
And how do I get the uniqe identifier back again?
(I only need the first available selected row)
ListView.SelectedListViewItemCollection selItems =
this.listView1.SelectedItems;
foreach ( ListViewItem item in selItems)
{
UniqeRowID = Convert.ToInt32(item.Tag.ToString());
}
I have found out a way to add rows, but is
this the correct way of doing this?
Where do I put a uniqe value to a row.
(listViewItem.Tag = UniqeRowID)
This is NOT the index number, but my own ID.
string[] s=new string[10]; // extra spare
s[0] = "Data Col 1";
s[1] = "Data Col 2";
s[2] = "Data Col 3";
s[3] = "Data Col 4";
System.Windows.Forms.ListViewItem listViewItem = new ListViewItem(s);
listViewItem.Tag = UniqeRowID;
this.listView1.Items.AddRange(new ListViewItem[] {listViewItem} );
And how do I get the uniqe identifier back again?
(I only need the first available selected row)
ListView.SelectedListViewItemCollection selItems =
this.listView1.SelectedItems;
foreach ( ListViewItem item in selItems)
{
UniqeRowID = Convert.ToInt32(item.Tag.ToString());
}