ListView, last item?

G

Guest

Hi, i have un listview in a winform, multiselect = true. I would like to know which is the last item to select when it several item selected there.

Best regards.
Sylvain
 
A

Allen Anderson

ListViewItem item;
if ( listview1.SelectedItems.Count > 0 )
item = listview1.SelectedItems[ listview1.SelectedItems.Count-1 ];

That should get you the last selected item.

Allen Anderson
http://www.glacialcomponents.com
mailto: allen@put my website url here.com
 
A

Allen Anderson

I believe listview1.FocusedItem would get that for you then.

Thanks for the answer, but I would like to know the last selected item by the mouse and key "CTRL".

Thanks a lot..

Allen Anderson said:
ListViewItem item;
if ( listview1.SelectedItems.Count > 0 )
item = listview1.SelectedItems[ listview1.SelectedItems.Count-1 ];

That should get you the last selected item.

Allen Anderson
http://www.glacialcomponents.com
mailto: allen@put my website url here.com

Hi, i have un listview in a winform, multiselect = true. I would like to know which is the last item to select when it several item selected there.

Best regards.
Sylvain
 

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