Solved

whether the content has changed in Rich Text Box

Posted on 1998-09-16
4
177 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
ID: 1435272
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
ID: 1435273
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
ID: 1435274
Sorry that's 2^16 for a fixed string.
0
 

Author Comment

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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

828 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