A
almurph
Hi,
I'm opening a file into a Stream object and then pass this object
into a StreamReader. I then use a while loop and the ReadLine()
method to count the number of rows in this StreamReader.
I go to use the StreamReader again and notice there is nothing in it.
It would appear that the ReadLine() function blanks it!
Anyone know any way to overcome this? Any hints/suggestions/ideas/
alternatives/code-samples much much appreciated.
Thank you,
Al.
**** Some Sample Code ****
'For a given streamreader - counts the # rows
Private Function RowCount(ByVal sr As StreamReader) As Integer
Static Dim counter As Integer = 0
While Not (sr.ReadLine Is Nothing)
counter = counter + 1
End While
Return counter
End Function
I'm opening a file into a Stream object and then pass this object
into a StreamReader. I then use a while loop and the ReadLine()
method to count the number of rows in this StreamReader.
I go to use the StreamReader again and notice there is nothing in it.
It would appear that the ReadLine() function blanks it!
Anyone know any way to overcome this? Any hints/suggestions/ideas/
alternatives/code-samples much much appreciated.
Thank you,
Al.
**** Some Sample Code ****
'For a given streamreader - counts the # rows
Private Function RowCount(ByVal sr As StreamReader) As Integer
Static Dim counter As Integer = 0
While Not (sr.ReadLine Is Nothing)
counter = counter + 1
End While
Return counter
End Function