Saving Listbox data

The_Bunny

Member
Joined
Jul 29, 2008
Messages
5
Programming Experience
Beginner
I'm jsut wondering, how do i save data from my Listbox1 into a .txt file called E:\Answers.txt???

The Listbox contains this data
VB.NET:
Dim list(150) As Integer
        Dim count As Integer
        list(count) = TextBox3.Text
        Form2.ListBox1.Items.Add(list(count))

It wall all be numbers if that helps :p
 
But it doesn't explain how to insert it into my code...

VB.NET:
Dim file As System.IO.StreamWriter
        file = My.Computer.FileSystem.OpenTextFileWriter("E:\Answer.txt", True)
        file.WriteLine(ListBox1.Text)
        file.Close()

I tried that but it only puts the word Listbox1.Text into my .txt file :p

I tried replacing with the .Text after the Listbox with jsut nothing, but that came out with:
"System.Windows.Forms.ListBox, Items.Count: 4, Items[0]: 52"

doesn't seem to be working to well
 
Back
Top