Hello,

I am writing entries to a text file, to use as a buffer of the last ten messages sent in a simple chat program. I write the entries as they are sent/received to a text file named as a specific user. This way when that user's chat window is opened again, the last ten messages can be filled into the history text box. I know how to add lines to the file just fine, I am using this to make the entries when sending a message:

Code:
Using sw As New StreamWriter(strFile, True)

     sw.WriteLine("• " & Sender & "(" & DateTime.Now & "): " & Message)

End Using
I don't know if it would be necessary or not, but I placed that character at the beginning of the string to serve as a marker, in case someone's message was so long it wraps to another line - does that even happen with stream writer?
Anyway, what I would like to add in is before writing a new line - count how many lines or marker characters are already in that file and if there are already ten, delete the top line. This way when the current line is added, it maintains that there will never be more than 10 lines in the file. Can someone point me in the right direction?