Getting index of a column in a ListView
Hi,
I am looking around for a way to get the index of a column by the name of it. The problem I want to solve is the manipulation of subitems in a ListView. At the moment I do it in that way:
Code:
foreach (ListViewItem lvi in myListView.SelectedItems)
lvi.SubItems[4].Text = "myText";
The problem is that I have to select by a number. If I add a column later and reorder the columns I have to replace all numbers in the source code. I think there is a way to get the index at runtime from the column by the name of the column.
Any suggestions?
Useful or not? Rate my posting. Thanks.