I am using the streamreader.readline class method to read a file with anywhere from 10 to 150 lines in it. However, Everytime I step threw my code, every 5th or 6th line that is read is missing approximately 4 characters. Does anyone know why it is doing this?
Here is my code:
Dim objReader As StreamReader
Dim sFileName As String
Dim count As Integer = 0
objReader = New StreamReader(sFileName, System.Text.Encoding.ASCII)
Dim sLine As String = Nothing
Do While (objReader.Peek() >= 0)
sLine = objReader.ReadLine() 'This is where it fails. When I read the line, it is missing approx. 4 chars. at the 112th position.
sLine.PadRight(226) ' do this to parse through the line
objReader.BaseStream.Position = objReader.BaseStream.Position + 1
'Parse through the line here.