Hi All,
can anyone tell me where I have gone wrong ?? I am trying to read in a text file and add a ":" to the end of each line, this is what I have so far:
Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProcess.Click
Dim path As String = "c:\mydata\test.txt"
Try
'If File.Exists(path) Then
'File.Delete(path)
'End If
Dim sw As StreamWriter = New StreamWriter(path)
Dim sr As StreamReader = New StreamReader(path)
If sr.Peek() >= -1 Then
sw.WriteLine(":")
End If
sw.Close()
sr.Close()
Catch e As Exception
Console.WriteLine("The process failed: {0}", e.ToString())
End Try
End Sub
Also, if anyone knows how to remove blank lines, this would also be appreciated.
dagoose
