StreamReader reads from another file

  • Thread starter Thread starter martinaguilar
  • Start date Start date
M

martinaguilar

I have 2 text files. No matter what I do, this code always read lines
from the same file and not from the file specified in txtFile.Text. I
can't get it... any idea why?

Dim oRead As StreamReader
Dim fs As FileStream
Dim cLine As String

fs = New FileStream(txtFile.Text, FileMode.Open)
oRead = New StreamReader(fs)

Do
lblCantReg.Text = k.ToString
cLine = oRead.ReadLine()
'Process cLine


Loop Until cLine Is Nothing
oRead.Close()
fs.Close()
 
Back
Top