Results 1 to 2 of 2

Thread: How to save listbox contents

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2011
    Posts
    12

    How to save listbox contents

    Hi, like title says, I want to save the listbox contents in to xyz.txt
    How can i do this in VB? I want it to save automaticaly into C:\xyz.txt

    BR and thnx for your help.

  2. #2
    Junior Member
    Join Date
    Jan 2011
    Posts
    28

    Re: How to save listbox contents

    Try:
    Code:
            Dim Writer As New System.IO.StreamWriter("C:\xyz.txt")
            For i = 0 To ListBox1.Items.Count - 1
                Writer.WriteLine(ListBox1.Items.Item(i))
            Next i
            Writer.Close()

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