save listview subitems to a text file
hi, i search this forum for my issue but cannot find anything. so i want your help. i have a listview (view:report) as bill displace. i want to save all rows into a text file. for example.
Product_________Qty_________Rate_________Amount
Item1___________50_________10.67_________533.50
Item2___________40__________8.67_________346.80
so i want to save all items like that in a text file from my listview. please help me.
thanks!!!
Re: save listview subitems to a text file
Try
vb Code:
Private Sub Command1_Click()
Dim i As Integer
Open "c:\listview.txt" For Output As #1
For i = 1 To ListView1.ListItems.Count
With ListView1.ListItems
Print #1, .Item(i).Text & " " & _
.Item(i).SubItems(1) & " " & _
.Item(i).SubItems(2) & " " & _
.Item(i).SubItems(3)
End With
Next
Close #1
End Sub
Re: save listview subitems to a text file
thank you very much. you just solved my problem that i trying to solve from the last 2 days. thank you once again for the code and help:wave::wave: