This message was edited by soweyoung at 2004-7-23 8:10:53
Hello everyone,
I am working on a small program in vb.net which reads a line at a time from a text file and writes a new line back to the file.
What I am trying to do is that I read from a text file line by line and want to be able to write a new line at the every third line.
The code is below. Any comments would be appreciated.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim inputString As String
Dim sb As New StreamReader("C:\test.txt")
Dim i As Long
i = 1
inputString = sb.ReadLine
While Not inputString Is Nothing
If i = 3 Then
'want to write a line of message to a file right at this position
i = 0
End If
i += 1
inputString = sb.ReadLine
End While
End Sub