473,387 Members | 1,532 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

compare a text file?

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

Jul 22 '06 #1
2 1040
The secton ReadToEnd is probably reading after the last row.

Cor

"Rudy" <Ru**@discussions.microsoft.comschreef in bericht
news:C8**********************************@microsof t.com...
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

Jul 22 '06 #2
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" <Ru**@discussions.microsoft.comschreef in bericht
news:C8**********************************@microsof t.com...
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


Jul 22 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: RitaG | last post by:
Hi. In a VB.Net program I use File.Copy to copy some zipped (and text) files from one server to another. I'm required by management to do a file compare after the copy has completed. Is the...
5
by: Megan | last post by:
Hi everybody- I'm helping a friend with a music database. She has an old one and is creating a new one. She wants to compare records and fields in the old database with records and fields in the...
8
by: Vincent | last post by:
has any one seen a program to compare mdbs'. I have ran into a few of them, but none seem to really do that job. Basically what I need to do is, take 2 access mdb's and check the differences...
1
by: Linda | last post by:
Hi, Is there a way to do a "text" (rather than "binary") compareison with the "like" operator, without changing the global "Option Compare" setting? I don't want to risk breaking many, many...
13
by: huiling25 | last post by:
I have a text file, i open the file and try to match the contents of the text file to a text. Here's my code: FileInputStream input = new FileInputStream ("BinaryFp.txt"); BufferedReader br = new...
7
stealwings
by: stealwings | last post by:
I have a little problem with my program, or maybe it is not that little, anyway here is the code: #include "stdafx.h" #include <iostream> using namespace std; #include <fstream> using...
0
by: Michael Jenck | last post by:
Hi All, I have been playing with the codedom and can't get it to output for option compare Binary with a CodeCompileUnit. I have searched the web and Don't now if it's possible. If it's not...
8
by: Perl Beginner | last post by:
I am new to Perl and new to this site. I have the same question that I keep seeing, but not finding an answer…why doesn’t the compare function work? I’ve been going at this for a while. My code is...
6
by: napatel04 | last post by:
Hi everyone, I would like to know if there is a quick query someone can help me write for the following scenario. I think I can do this with VBA but since this is suppose to be a temp. solution,...
3
by: onequestion | last post by:
Hi Friends, I have one question, I need to check certain url's in a text file with url's stored in cache(access.log). Here the problem is, Assume i have stored...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.