I'm just getting into programming, bit of a newbie.
I'm having an issue with the streamreader. I had it working but I've changed something and it has stopped.
I have it in a Do While loop reading line by line, but it doesn't finish reading. It reads about 27 lines out of 4000, then stops.
I changed the contents of the file it was reading, but it's still just save as a txt notepad file.
I also changed how I tell it which file to open (UserSelection.T2) however it does open the file just doesn't finish reading it.
Doesn't kick back any errors, it just doesn't read the entire file.
Expand|Select|Wrap|Line Numbers
- Dim FSO As Object
- Dim File As Object
- FSO = CreateObject("Scripting.FileSystemObject")
- File = FSO.OpenTextFile(UserSelection.T2, 1)
- File.ReadAll()
- Dim FileLength As Integer
- FileLength = File.line - 1
- Dim FileLengthCounter As Integer = 0
- Dim sLine As String = ""
- Dim objReader As New StreamReader(UserSelection.T2)
- Do While FileLengthCounter < FileLength
- sLine = objReader.ReadLine()
- If Not sLine Is Nothing Then
- Dim StringSearch As Integer = 0
- StringSearch = InStr(sLine.ToString, sTextDate)
- if StringSearch > 0 Then
- 'do stuff
- End If
- End If
- End If
- FileLengthCounter = FileLengthCounter + 1
- Loop
- objReader.Close()