title: Listview items and saving them as .csv
body: <p>I'm doing this project where I need to save the names of the items from a listview to a .csv </p>
  
  <pre><code>Imports System.IO
  
  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"
  
      Dim returnValue As String()
      returnValue = Environment.GetCommandLineArgs()
      If returnValue.Length &gt; 1 Then
          MessageBox.Show(returnValue(1).ToString())
      Else
          MessageBox.Show("Nothing")
      End If
  
      ' Set ListView Properties  
      lstvicon.View = View.Details
      lstvicon.GridLines = False
      lstvicon.FullRowSelect = True
      lstvicon.HideSelection = False
      lstvicon.MultiSelect = True
  
      ' Create Columns Headers  
      lstvicon.Columns.Add("Nome")
      lstvicon.Columns.Add("Extensão")
      lstvicon.Columns.Add("Tamanho")
      lstvicon.Columns.Add("Data Modificação")
  
      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)
          li.SubItems.Add(file.Extension)
          li.SubItems.Add(file.Length)
          li.SubItems.Add(file.LastWriteTimeUtc)
          'li.SubItems.Add(FileDialog)
      Next
  
  
  
  End Sub
  
  Private Sub btnimp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnimp.Click
  
      ' Creates a csv File
      Dim csv As New System.IO.StreamWriter("C:\Documents and Settings\Software\Ambiente de trabalho\cv7import\teste.csv", True)
  
      lstvicon.SelectedItems.CopyTo(csv)
  
      csv.Close()
  
  
  End Sub
  End Class
  </code></pre>
  
  <p>That's what I got but I can't seem to get it to write on the .txt. </p>
  
  <p>I have no idea where to go from here and i've been going around this for hours, so any help would be apreciated.</p>