listview click

  • Thread starter Thread starter Jon Vaughan
  • Start date Start date
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
 
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
 
Back
Top