Map ListView.Columns[].Index to ListView.Items[].SubItems index

S

Samuel R. Neff

I'm having a index problem with ListView SubItems. If I add multiple
columns to the listview and then add items with associated subitems,
the ListView displays fine. Then if I delete a column via
ListView.Columns.RemoveAt() then the ListView still displays fine.
However, if I grab a subitem value via

listView.Items[itemIndex].SubItems[column.Index].Text

Then I get the Text of the wrong column.

If the ListView internally knows what Column is associated with which
SubItem, how can we find out after columns have been added/removed?

Thanks,

Sam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top