compare a text file?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello all!

Another simple one that has me scracthing my head. I just want to read a
text file, if it reads a certain string, then pop up a message box that
states something. Here is my code, what am I doing wrong?


Dim StreamToDisplay As StreamReader
StreamToDisplay = New StreamReader("e:\switch.txt")
If StreamToDisplay.ReadToEnd.Equals("ECHO is on.") Then
MsgBox("OFF")
Else
MsgBox(StreamToDisplay.ReadToEnd)
End If
StreamToDisplay.Close()
TIA!!
Rudy
 
Back
Top