I have a set of labels that contain number values that need to be saved into a txt file and recalled from a text file by a button click event.
Ive been searching these fourms for days trying to find the answer to the save / load data problem. From what I understand, XML should be used to do this. But no matter how much I read I cant make sense out of how to solve this issue. I just need a simple and quick fix that dosen't have to use XML
any Ideas?
this code makes sense to me now.
Ive been searching these fourms for days trying to find the answer to the save / load data problem. From what I understand, XML should be used to do this. But no matter how much I read I cant make sense out of how to solve this issue. I just need a simple and quick fix that dosen't have to use XML
any Ideas?
this code makes sense to me now.
VB.NET:
'To save using a SaveFileDialog
If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
Dim w As New System.IO.StreamWriter(SaveFileDialog1.FileName, False)
w.WriteLine(TextBox1.Text )
w.WriteLine(TextBox2.Text)
w.Close()
End If
'To read back using an OpenFileDialog
If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
Dim r As New System.IO.StreamReader(OpenFileDialog1.FileName)
If r.Peek > -1 Then TextBox1.Text = CStr(r.ReadLine)
If r.Peek > -1 Then TextBox2.Text = CStr(r.ReadLine)
r.Close()
End If
Last edited: