My application is suppose to save the information that I put in the application that is in a listbox in form2. All the information is in form1, but I got it to save it in the listbox in form2 and I can see it when I load up the form2. Im suppose to make 10 different list for it, (it says it should be in arrays, but I dont know how to do it) and I should be able to save them everytime I put a new one in, but when I put a new list in the listbox and close the application and then reopen it, its erased, how do I save it and keep it in the lstbox so it doesnt get erased?
rookanga
0
Junior Poster in Training
Recommended Answers
Jump to PostSee if this helps.
Public Class Form1 Private myListBoxItemsFile As String = "C:\myListBoxItemsFile.txt" '// your file. '// Save to File from ListBox. Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing Dim myCoolWriter As New IO.StreamWriter(myListBoxItemsFile) For Each coolItem In ListBox1.Items '// loop thru …
Jump to PostVery confusing to understand.
Try my provided code in a new project with just one ListBox.
You can add a Button and a TextBox to that Form, and have in Button1.Click...Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ListBox1.Items.Add(TextBox1.Text) '// add …
Jump to PostTheres nothing wrong with codeorder's post. You will probably want to use that method. I'm just adding an additional method to save a listbox's ObjectCollection.
A list box can have strings or objects. This method will save any item in the items collection as long as the objects in …
Jump to PostButtonSave Saves. ButtonLoad Loads.
I don't quite understand what you are doing.
Form1? Are the listboxes on form 1. You enter in information into the listboxes and then save them. When form1 reopens after being closed the information entered in previously will appear in form1's listboxes.
What …
All 13 Replies
codeorder
197
Nearly a Posting Virtuoso
rookanga
0
Junior Poster in Training
codeorder
197
Nearly a Posting Virtuoso
rookanga
0
Junior Poster in Training

Unhnd_Exception
rookanga
0
Junior Poster in Training
rookanga
0
Junior Poster in Training

Unhnd_Exception
rookanga
0
Junior Poster in Training
codeorder
197
Nearly a Posting Virtuoso
rookanga
0
Junior Poster in Training

Unhnd_Exception
P.manidas
39
Posting Whiz in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.