Hi all,
I would like to be able to read data from a text file, be able to edit it and save the new edits to that file over writing the old ones.
Dim FILE_NAME As String = "C:\cat4\text.txt"
Dim TextLine As String
If System.IO.File.Exists(FILE_NAME) = True Then
Dim objReader As New System.IO.StreamReader(FILE_NAME)
Do While objReader.Peek() <> -1
TextLine = TextLine & objReader.ReadLine() & vbNewLine
Loop
RichTextBox1.Text = TextLine
Else
MsgBox("File Does Not Exist")
End If
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim mydoclocation As String = My.Computer.FileSystem.SpecialDirectories.MyDocuments
RichTextBox1.SaveFile(mydoclocation & "c:\cat4\text.txt", RichTextBoxStreamType.PlainText)
End Sub