PC Review


Reply
Thread Tools Rate Thread

compare a text file?

 
 
=?Utf-8?B?UnVkeQ==?=
Guest
Posts: n/a
 
      22nd Jul 2006
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

 
Reply With Quote
 
 
 
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      22nd Jul 2006
The secton ReadToEnd is probably reading after the last row.

Cor

"Rudy" <(E-Mail Removed)> schreef in bericht
news:C84907DC-C821-4F53-966E-(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
=?Utf-8?B?UnVkeQ==?=
Guest
Posts: n/a
 
      22nd Jul 2006
Thanks Cor! I should have had ReadLine instead.
Have a good weekend!

Rudy

"Cor Ligthert [MVP]" wrote:

> The secton ReadToEnd is probably reading after the last row.
>
> Cor
>
> "Rudy" <(E-Mail Removed)> schreef in bericht
> news:C84907DC-C821-4F53-966E-(E-Mail Removed)...
> > 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
> >

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Utility for text file compare? Rick Windows XP General 5 13th Jan 2009 11:09 PM
Text File Compare Microsoft Windows 2000 CMD Promt 11 11th Jun 2007 06:46 PM
[Update] Text File Compare v1.60 (no setup) Mel Freeware 7 18th Jun 2005 02:35 AM
Req: Text File Compare Mike Freeware 3 2nd Aug 2004 09:40 AM
[Update]AsciiDiff text file compare V1.5.5 available Adrian Carter Freeware 0 1st Mar 2004 09:48 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:31 PM.