title: Opening listview items with a double click vb.net
body: <p>I want to open items from a list view with a double click. </p>
  
  <pre><code>Imports System.IO
  Imports System.Xml
  Public Class cv7import
  
  Private Sub cv7import_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      Dim caminho As String
      caminho = "C:\Documents and Settings\Software\Ambiente de trabalho\cv7import"
  
  
  
      lstvicon.View = View.Details
      lstvicon.GridLines = False
      lstvicon.FullRowSelect = True
      lstvicon.HideSelection = False
      lstvicon.MultiSelect = True
  
  
      lstvicon.Columns.Add("Nome")
      lstvicon.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize)
  
  
      Dim DI As System.IO.DirectoryInfo = New System.IO.DirectoryInfo(caminho)
  
      Dim files() As System.IO.FileInfo = DI.GetFiles
  
      Dim file As System.IO.FileInfo
  
      Dim li As ListViewItem
      For Each file In files
          li = lstvicon.Items.Add(file.Name)
  
  
      Next
  
  End Sub
  
  
  
  Private Sub btnimp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnimp.Click
  
      Dim caminho As String
      caminho = "C:\Documents and Settings\Software\Ambiente de trabalho\cv7import"
  
  
      Dim items() As ListViewItem = lstvicon.SelectedItems.Cast(Of ListViewItem).ToArray
      Dim csv() As String = Array.ConvertAll(items, Function(lvi) String.Join(",", lvi.SubItems.Cast(Of ListViewItem.ListViewSubItem).Select(Function(si) si.Text).ToArray))
      IO.File.WriteAllLines("C:\Documents and Settings\Software\Ambiente de trabalho\cv7import\teste.csv", csv)
  
  End Class
  </code></pre>
  
  <p>That's the important part of the code, I was think of using onclick but I cant seem to get anywhere with it, any suggestions?</p>
  
  <p>I also considered using and Open File Dialog but I dont think it can be done without the user's input of a path</p>