listview Selecteditem

flann

Freshman
Joined
Aug 16, 2005
Messages
33
listview Selecteditem [RESOLVED]

does anybody know how I can get the index of a selected item in a listview?
 
Last edited:
tried both? here's what I have..

Dim oProcess As System.Diagnostics.Process
Dim x As Integer
x = ListView1.SelectedItems.IndexOf
oProcess.Start(strFiles(x))
 
How about this?

Code:
Private Sub ListView1_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.DoubleClick

  Dim index As Integer
  Dim item As ListViewItem

  item = ListView1.SelectedItem
  index = item.Index

  'OR

  For Each item As ListViewItem in ListView1.SelectedItems
    index = item.Index
  Next
End Sub
 
this worked.

Dim x As Integer
For Each x In ListView1.SelectedIndices
Dim oProcess As System.Diagnostics.Process
oProcess.Start(strFiles(x))
Next
 
Back
Top