hiya,
What i am trying to do is save text from a number of text boxes to a user named file then subsequently be able to reload the data back into the same text boxes at a later date.
so far i have this which was provided for elsewhere on the web, this allows me to save comma delineated data to a file which is fine but i can't seem to reload the data. As an experiment i have just tried to reload it back into a rich text box to see if the process would work but nothing as yet.
Private Sub SAveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SAveToolStripMenuItem.Click
Dim savedfile As String
savedfile = TextBoxinc1.Text & "," & TextBoxinc2.Text & ","
Dim Save As New SaveFileDialog()
Dim myStreamWriter As System.IO.StreamWriter
Save.Filter = "Text Format [*.txt*]|*.txt|All Files [*.*]|*.*"
Save.CheckPathExists = True
Save.Title = "Save"
Save.ShowDialog(Me)
Try
Catch ex As Exception
End Try
myStreamWriter = System.IO.File.AppendText(Save.FileName)
myStreamWriter.Write(savedfile)
myStreamWriter.Flush()
Try
Catch ex As Exception
End Try
End Sub
Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click
Dim Open As New OpenFileDialog()
Dim myStreamReader As System.IO.StreamReader
Open.Filter = "Text Format [*.txt*]|*.txt|All Files [*.*]|*.*"
Open.CheckFileExists = True
Open.Title = "Open"
Open.ShowDialog(Me)
Try
Open.OpenFile()
myStreamReader = System.IO.File.OpenText(Open.FileName)
RichTextBox1.Rtf = myStreamReader.ReadToEnd()
Catch ex As Exception
End Try
End Sub
End Class