Listview item click events
-
In a winform using C#, I have a listview to which I've added some items... I want to be able to detect a double click event on an item that will tell me which item was double clicked. I've tried the double click event for the listview, but it has no info about which item was clicked... I need listview item event info.. can someone give me some advice as to how this can be done...? thanks.
-
In a winform using C#, I have a listview to which I've added some items... I want to be able to detect a double click event on an item that will tell me which item was double clicked. I've tried the double click event for the listview, but it has no info about which item was clicked... I need listview item event info.. can someone give me some advice as to how this can be done...? thanks.
vlusardi wrote: can someone give me some advice as to how this can be done...? Use the
ListView
'sGetItemAt
method to retrieve the item which was clicked. You get the point that was clicked by using the staticControl.MousePosition
property, then pass that through theListView
'sPointToClient
method (to convert from screen coordinates to ones relative to the listview). f.eListViewItem lvi = myListView.GetItemAt(
myListView.PointToClient(Control.MousePosition)
);HTH, James "It is self repeating, of unknown pattern" Data - Star Trek: The Next Generation
-
In a winform using C#, I have a listview to which I've added some items... I want to be able to detect a double click event on an item that will tell me which item was double clicked. I've tried the double click event for the listview, but it has no info about which item was clicked... I need listview item event info.. can someone give me some advice as to how this can be done...? thanks.
-
Set Activation property of ListView to 'Standard' and in 'ItemActivate Event' of ListView use the following code to get listview item info - ListViewItem itms = listView.SelectedItems[0];