
Originally Posted by
hopefordope
Zoom how did you get form1.closing
When you're in the code section of your project you will notice 2 drop down bars at the top
Click the left one and choose: (form1 events)
then click the second one and choose: Form Closing
It'll set up the template sub procedure for you, then add the code.
I just use this function for reading:
Make this import
[php]
Imports System.IO
[/php]
Then make this function to read files.
[php]
Private Function Readit(ByVal file As String)
Dim lbitems As String = ""
try
Using sr As Streamreader = New Streamreader(file)
lbitems = sr.readline
Do While (Not lbitems Is Nothing)
ListBox1.Items.Add(lbitems)
Console.WriteLine(lbitems)
lbitems = sr.ReadLine
Loop
End Using
catch ex as Exception
MsgBox("An error occurred: " & ex.ToString)
Return lbitems
End Function
[/php]
Then to use it
[php]
If My.Computer.FileSystem.FileExists(application.star tuppath & "\items.txt") then
readit((application.startuppath & "\items.txt")
End if
[/php]
You should be able to play around with that to get it to write as well. I've got school now so I can't finish it off haha.