Unanswered: How to write to text file instead of viewing data in listview?
Hi all . I have a search result that is outputed to listview in my vb6 form and i wonder how i can write the output data in to text file which is readable instead of showing it listview. I be happy if an expert show me how .Thanks
Here is my code that displays data in lisview . I want the data to be writen in text file instead:
Private Sub cReg_SearchFound(ByVal sRootKey As String, ByVal sKey As String, ByVal sValue As Variant, ByVal lFound As FOUND_WHERE)
Dim lvItm As ListItem
Select Case lFound
sTemp = "KEY_NAME"
sTemp = "VALUE NAME"
sTemp = "VALUE VALUE"
Set lvItm = .ListItems.Add(, , sTemp)
lvItm.SubItems(1) = sRootKey
lvItm.SubItems(2) = sKey
lvItm.SubItems(3) = sValue
End With Set lvItm = Nothing
As a first step, you will need to define the format of the file; that is, how the data will be stored in the text file. I would think that the standard, comma separated variable (csv) format would be applicable.
Then, as a second step, take a look at this File I/O Tutorial over at our sister-site for info on actually reading and writing files using VB.
"Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
"I have my standards. They may be low, but I have them!" - Bette Middler
"It's a book about a Spanish guy named Manual. You should read it." - Dilbert