ListView subitem

L

Larry Hilley

I have a listview that I need to get the text in a subitem in a selected
item (line).
I can get the selected item index, but I can not get the data back from the
subitem.
If you can point me to an example or tell me how to do it that would be
great!
The is managed C++ but C# will do.

Thanks!
Larry Hilley
 
C

Claes Bergefall

myListView.SelectedItems(0).SubItems contains
all subitems for the first selected item

/claes
 
L

Larry Hilley

Hi, thanks for the help.

I tried to find the C++ version of your code but could not.
I did make it work, and I am sure there is a better way, but here is
what worked.

ListViewItem * subitem1;
subitem1 = listView1->Items->get_Item(k);
String* mysubitem = subitem1->SubItems->get_Item(4)->Text;

where listView1 is my litview
k is the selectef line index
4 inst index to the forth subitem

Thanks again, Larry Hilley

PS: Someone please write a book with real programs for examples. All I
found just setup the list view and did not use it.
 

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