compare a text file?

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top