I'm writing an app that creates a status text file. Any time there was a change I'd write to the file by:
Code:
Status_Message_Text = DateString + " " + TimeString + " " + Status_Message + vbCrLf
My.Computer.FileSystem.WriteAllText(File_Path, Status_Message_Text, True)
Elsewhere I display it in a Text Box:
Code:
txtStatusLog.Text = My.Computer.FileSystem.ReadAllText(File_Path)
It works fabulous except that the write appends the text at the end.
I'd like either a way to insert the text at the beginning of the file or somehow sort the display in the Text Box because I want to display the most recent status message first.
For now I changed the write so that the Status_Message_Text reads in the file and the write over-writes the file:
Code:
Status_Message_Text = DateString + " " + TimeString + " " + Status_Message + vbCrLf + My.Computer.FileSystem.ReadAllText(File_Path)
My.Computer.FileSystem.WriteAllText(File_Path, Status_Message_Text, False)
There's got to be a better way!
Any ideas?
THANKS!