Jay1b Posted March 21, 2005 Posted March 21, 2005 When the user clicks on a row in a listview box (arranged as detail), i would like to carry out an action. This is easily enough, but i am having trouble detecting what row the user click upon. I've thought about using Checkboxes, but only one must be ticked at any one time and i couldnt figure out a way to uncheck any other checkboxes when you tick one. Just looking for someone to point me in the right direction really. Thanks. Quote
Wile Posted March 21, 2005 Posted March 21, 2005 One way would be to disable multiselect, and then on the 'selectedindexchanged' (or any other) event check which item is selected (.selectedItems property of the listview). With multiselect disabled there can never be more than 1 item, there can however be 0 items selected so you still have to check for that. Quote Nothing is as illusive as 'the last bug'.
Tygur Posted March 21, 2005 Posted March 21, 2005 Actually, the event you probably want is ItemActivate. Quote
pendragon Posted March 21, 2005 Posted March 21, 2005 As Wile says disable multiselect then in your click event for the listview you can use YourListView.SelectedItems[0].Text or YourListView.SelectedItems[0].SubItems[1].Text to get the information from the line they clicked. Quote
Jay1b Posted March 21, 2005 Author Posted March 21, 2005 Thanks i've used ItemActivate and that works. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.