winforms - How to detect previous state of text field in C#? -


I am coding a simple text editor using the Windows form as many editors, when in the text The change occurs, the title bar displays an asterisk in front of the title, showing that the unsaved work is done when the user saves it, it goes away.

However, there is a problem. It is controlled in the event of the replacement of the main text box. But it is also said when a file is opened or the user selects "new file", so that you open the editor and then open a file, the program says that unsaved changes are possible solutions?

I thought of having a global variable that the text has changed in a way that should not trigger asterisk, but there should be a better way.

Before loading data in a text box, unhandicipate eventhandler for first change

< Pre> uxName. TextChanged - = uxName_Text changed; UxName.Text = File Read all the text ("something.txt"); UxName.TextChanged + = uxName_Text changed;

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -