Page 2 of 2

Re: Listbox HELP ?

Posted: Mon Jul 12, 2010 1:41 pm
by lesan101
mandai wrote:
What are you asking for exactly? Something to copy listbox items from one listbox to another?
okay the passwords are added to the list box on form2
i close form2
i close form1 (whitch is the adding form)
i open program again..
i go to form2
i see the passwords there saved :)

but how do i save theM>?

Re: Listbox HELP ?

Posted: Mon Jul 12, 2010 3:27 pm
by mandai
In the form2 closing event you can try this:
Code: Select all
File.Delete("items.txt")
For i As Integer = 0 To ListBox1.Items.Count - 1
       File.AppendAllText("items.txt", ListBox1.Items(i) & vbCrLf)
Next
Then on the form2 load event use this:
Code: Select all
Dim lines As String() = File.ReadAllLines("items.txt")
For i As Integer = 0 To lines.Length - 1
       ListBox1.Items.Add(lines(i))
Next

Re: Listbox HELP ?

Posted: Sun Aug 01, 2010 9:09 pm
by TerrorFoX
Oh, thx i needed this soo much!

Great Work.