Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing ListView Detail Column Data

Status
Not open for further replies.

xpios

Programmer
Jan 25, 2005
4
US
Hi,

This is probably a dumb question, but I just haven't found a straightforward answer to it.

I have a listview running in Detail mode. Basically, it's a list of data with multiple columns of data. I know how to get the value of the first column of any record. However, sometimes I want to get the value of the other columns in the record. How do I do this?

Thanks in advance.
 
If I understand your question, then it's not too tough. All the rows in your detail view ListBox are considered ListViewItems. ListViewItems have a "subitems" property that lets you easily get at the "columns".

So, for example,

ListViewItem yourVar = YourListView.Items[0];

MessageBox.Show(yourVar.SubItems[1].Text);

will show you the second column. Does that help?
 
That was the ticket... thank you very much. I have to say the documentation is somewhat poor on how to do this. Your help is much appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top