title: How to Save listview items to a text file on VB6
body: <p>I have data in my listview1 like this:</p>
  
  <p><a href="https://i.stack.imgur.com/5veXI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5veXI.png" alt="listview"></a></p>
  
  <p>And i want to save Quantity until Total cost Coloum from that listview to .txt
  but i dont know how to save it to .txt </p>
  
  <p>i found the referencee drom another web, they used this code:</p>
  
  <pre><code>Private Sub testfile as String = application.startupPath &amp; "\testfile.txt"
  </code></pre>
  
  <h2>print(click)</h2>
  
  <pre><code>Dim mywriter as new.IO.streamwriter(testfile)
      for eacy myItem as ListviewItem in Listview1.items
          mywriter.writeLine(myitem.text &amp; "#" &amp; myItem.SubItem(1).text &amp; "#" &amp; myitem.subitem(2).text)
      next
      mywriter.close()
  </code></pre>
  
  <p>but VB6 can't compile this code.
  please help me</p>