Jump to content
Xtreme .Net Talk

ListView, a couple of questions on howto?


Recommended Posts

Guest cgchris99
Posted

I wanted to be able to tell which Item/Image was selected in a ListView. I have the multiselect set to false. I only want them to pick one item at a time.

 

So here is my code

 

test=iew.SelectedIndices(0)

 

This works only the first time they pick one. If they pick a different item in the list, it throws an exception.

 

Any ideas?

 

Second question.

Can I keep the selected image from turning blue? Or is there a way to have it display a different image for the selected one?

 

Thanks

  • 4 months later...
Posted

Protection for lvw.SelectedIndices

 

You need to protect the index selection. Make sure that there is only one item selected before using SelectedIndices.

Here's an example:

 

 If ListView1.SelectedItems.Count = 1 Then 
       intIndex = Int(ListView1.SelectedIndices(0))   

 

hope this helps. ;)

  • 10 months later...

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...