Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I make a test on a text-box if the text are changed or not? 1

Status
Not open for further replies.

stigejg

Technical User
Mar 28, 2001
55
NO
Hello,

I am sitting here programming a simple (to start with) text editor. And now I met the brick wall……

I am using VB 60 Learning edition so the text area in my editor is a text box. Here I want to build in a check if the text-document I have been working with is changed and therefor have to be prompted if I want to save these changes or no when I am quitting or opening a new document (just like the notepad in windows).

So my question is:

Can anyone out there give me a hint of how I can do the test of a document have been changed or not. I have tryed to read and search trough all my documentation an are not able to find out of this.

Tanks Stig
 
Hi Stig

In your form module -> general, click your textbox, in declarations, click "change". every time your text changes, this event procedure is called, put whatever code you need there.

Jon
 
Stig,
Use the Change event on the text control property and set a flag and test the value on exit to see if set to true.

Regards,Nick
 
Thanks folks,

The easyest part is the change event, the tricky one is how I can check the content in the text box against the stored text-document on a easy way.

One way is to count the lenght of the file while loading it and compare this against the lenght of the same file when i am quiting (but then i don't catch any changes if I have the same number og digits in the changed text).

So I am searching for an simple way of comparing the new (changed) text against the original one.

Some tips of how I can do this an easy way?

Stig
 
Hi Stig,
I think you don't have to compare the files. Using the change-method is quiet good.
Whenever the user hits a key, enters new text, the file/text is changed - and this method called.
- And i thought that's what you want...

But if you really want to compare the content of two files (you really don't have to do that),
look at this site:

Hope that helped
bateman23

---------------------------------------
Visit me @:
 
Hello bateman, Thanks the link you gave me was wery helpul.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top