Hi Jason,
Is it possible that at some point filecont is Nothing and therefore you
don't exit the loop properly?
You are checking for an empty string (filecont = "") which may not indicate
the true end of the file.
Ken
<> wrote in message
news: m...
> The below code fails with the above error on the indexof line (IF line
> 3/4 of the way down). I've used indexof before, but for some reason it
> won't work in this loop. Thanks for any help or information.
>
> Dim InString As String = ""
> Dim LogInfo As New FileStream("d:\xxx\xx1.log",
> fileShare.ReadWrite,FileAccess.Read)
> Dim LogReadStream As New StreamReader(LogInfo)
> Dim filecont as string
> Do
> filecont = LogReadStream.ReadLine()
> 'if line contains (ERRORING LINE BELOW)
> if (filecont.indexof("Default.aspx") <> - 1)
> Response.Write( filecont & "<br>" )
> end if
> Loop Until filecont = ""
> LogReadStream.Close
|