Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Does anyone know how to get the imageindex of a listview item? I can get if I dim a variable and put it inside a For Each loop. I don't want it to run through a loop since I already know which item is selected.

 

Here's what I'm trying to do. It doesn't work.

Dim ListItem As ListViewItem
If Button.MouseButtons = Windows.Forms.MouseButtons.Right And ListItem.ImageIndex = 5 Then

  • Leaders
Posted

What are you looking for, specifically? The ImageIndex of the selected ListViewItem?

 

Does this help?

'If user clicked with right mouse button
' and there is one and only one item selected
' and that item has an image index of five then...
If e.Button = Windows.Forms.MouseButtons.Right _
   AndAlso ListView1.SelectedItems.Count = 1 _
   AndAlso ListView1.SelectedItems(0).ImageIndex = 5 Then

   'Like, do things, and stuff...
End If

[sIGPIC]e[/sIGPIC]
Posted

That's exactly what I wanted. Thanks!

 

What are you looking for, specifically? The ImageIndex of the selected ListViewItem?

 

Does this help?

'If user clicked with right mouse button
' and there is one and only one item selected
' and that item has an image index of five then...
If e.Button = Windows.Forms.MouseButtons.Right _
   AndAlso ListView1.SelectedItems.Count = 1 _
   AndAlso ListView1.SelectedItems(0).ImageIndex = 5 Then

   'Like, do things, and stuff...
End If

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