|
-
January 18th, 2012, 09:26 AM
#1
How to get the ListView's Selected Column Index?
Hi,
Iam using C# 2010. I would like to know, is it possible to find a column value without knowing the column or subcolumn index from listview?
I mean, once the user click on second column, then I want to get the second column value...also, once the user click on third column then the reslutant has to be third column value...
Is it possible?
Iam using the following codes...for listview...
for (int F12 = 0; F12 <= MyDataTable.Length - 1; F12++)
{
ListViewItem GItem = new ListViewItem(MyDataTable[F12]["invoic_no"].ToString());
GItem.SubItems.Add(MyDataTable[F12]["invoice_date"].ToString());
GItem.SubItems.Add(MyDataTable[F12]["Supplier_name"].ToString());
GItem.SubItems.Add(MyDataTable[F12]["itm_description"].ToString());
GItem.SubItems.Add(MyDataTable[F12]["unit_measure"].ToString());
GItem.SubItems.Add(MyDataTable[F12]["Invoice_Quantity"].ToString());
listView1.Items.Add(GItem);
}
listView1.Visible = true;
listView1.Focus();
Note: ListView1.SelectedItems[0].text or
ListView1.SelectedItems[0].SubItems[1].text all will give the value by assigned column.
But My clarification is, is it possible to get the unkwon clicked column index...
Thanks
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|