Solved

whether the content has changed in Rich Text Box

Posted on 1998-09-16
4
173 Views
Last Modified: 2010-04-30
Dear Experts,

  I need to load a file(from local drive) into a rich text box. Then when the program terminates it will find out whether the content in the rich text box is "dirty" -- has been changed. If so save it. If I compare line by line I need to read each line into a string first. However, each line in the file might be longer than the 255 char limit for a string datatype. Also this might take a long time. What other solutions are there?

    Thanks!
0
Comment
Question by:happysam
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
cantrell earned 100 total points
Comment Utility
Make a global variable as a flag to see if the program has been changed. I.e.

dim ModifiedFlag as boolean

Then, in your "change" event in the rich text box, set the flag to "true".

When you exit your app, check the flag to see if it's true, if it is, then the file has been modified.

Does this answer your question? If not, I can tell you what you need to know. I have an app that does exactly what you're talking about.
0
 
LVL 1

Expert Comment

by:lawnranger
Comment Utility
Where did you get the idea that a string can only be 255 chars? In VB 5 a variable length string can be 2^31 chars and a fixed length string can be 2^15 chars so an alternative would be just to compare the strings if the change event has fired. If they are the same you can save the file write.
0
 
LVL 1

Expert Comment

by:lawnranger
Comment Utility
Sorry that's 2^16 for a fixed string.
0
 

Author Comment

by:happysam
Comment Utility
How can I covered this event?? But thanks to lawnranger and cantrell for correcting my mistakes!
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Use closed file on desktop in vba 6 56
Problem to skip loop 6 48
using Access 8 52
VBA/SQL - Connect to SQL server and pull data 4 65
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now