This is driving me nuts - simple matter in VC++ to get the index (row) of a listview when clicked.
All I want to do is get the integer index of the row clicked- that's it. I can't find it anywhere... read all the MSDN BS and could not find it.
Help!
Printable View
This is driving me nuts - simple matter in VC++ to get the index (row) of a listview when clicked.
All I want to do is get the integer index of the row clicked- that's it. I can't find it anywhere... read all the MSDN BS and could not find it.
Help!
Listview is not a row based control, it is item base control so I think it is not necessary to get a row in a Listview. And I found Listview is very helpful to find the selected item inside it by using the "listview.SelectedItems" method.
If u want the control that row base why don't you use the Listbox control ?
I'm sick of people bagging MSDN. BS indeed? Some times I think people read it with their eyes closed. A quick look at the ListView documentation reveals a GetItemAt method, described thusly:How would you get the coordinates? The MouseClick event provides them for you, or you could use the MouseDown event as in the code example provided in the GetItemAt documentation. There's also the HitTest method, described thusly:Quote:
Retrieves the item at the specified location.
Easy to do; easy to find.Quote:
Provides item information, given an x- and y-coordinate.