What's the easiest way to save content of my listview to txt

  • Thread starter Thread starter Vjay77
  • Start date Start date
V

Vjay77

What would be the easiest way to save content of my listview (all
columns) to comma delimited txt file on my local drive.
I plan on opening this file with ms excel, so I can get columns
separated by excel automatically.

I can read the content of 1 row and 1 column of my listview like
this:
dim text as string = ListView1.Items.Item(1).SubItems(1).Text()

But how do I write/save it to extract.txt text file on my c drive.

vjay
 
This is how to write to file.

sContents = GetFileContents("C:\test.txt", sErr)
If sErr = "" Then
Debug.WriteLine("File Contents: " & sContents)
'Save to different file
bAns = SaveTextToFile(sContents, "D:\Test.txt", sErr)
If bAns Then
Debug.WriteLine("File Saved!")
Else
Debug.WriteLine("Error Saving File: " & sErr)
End If

Else
Debug.WriteLine("Error retrieving file: " & sErr)
End If
 
Back
Top