Results 1 to 3 of 3

Thread: save listview subitems to a text file

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2011
    Location
    india
    Posts
    12

    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!!!

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: save listview subitems to a text file

    Try
    vb Code:
    1. Private Sub Command1_Click()
    2. Dim i As Integer
    3. Open "c:\listview.txt" For Output As #1
    4. For i = 1 To ListView1.ListItems.Count
    5.     With ListView1.ListItems
    6.         Print #1, .Item(i).Text & " " & _
    7.                   .Item(i).SubItems(1) & " " & _
    8.                   .Item(i).SubItems(2) & " " & _
    9.                   .Item(i).SubItems(3)
    10.     End With
    11. Next
    12. Close #1
    13. End Sub

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2011
    Location
    india
    Posts
    12

    Resolved 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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width