listview click

J

Jon Vaughan

Hey all,

Im having what I thought would be a common problem , but I have search the
net and found no solution.

Im converting code from .net framework to the compact, in the listview I
would use the getitemat method of the listview to locate the clicked item ,
but this isnt available in the compact. Im hoping that someone has a work
around for this

Thanks

Jon
 
P

Peter Foot [MVP]

Use the SelectedIndexChanged event instead - only make sure the index is
valid before you do anything with it - because the event is fired when no
item is selected which will leave the SelectedIndices collection with length
zero. e.g.

if(listView1.SelectedIndices.Count > 0)
{
//get the item at the first index
ListViewItem selectedItem =
listView1.Items(listView1.SelectedIndices(0));
}

Peter
 

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

Similar Threads


Top