Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

Posted
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.
Nothing is as illusive as 'the last bug'.
Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...