whether the content has changed in Rich Text Box

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!
happysamAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
cantrellConnect With a Mentor Commented:
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
 
lawnrangerCommented:
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
 
lawnrangerCommented:
Sorry that's 2^16 for a fixed string.
0
 
happysamAuthor Commented:
How can I covered this event?? But thanks to lawnranger and cantrell for correcting my mistakes!
0
All Courses

From novice to tech pro — start learning today.