checking if form data has been changed
<p>I have been trying the following C# code to check if form data has been changed before closing and saving but it seems that it always reports the form as being changed even when no changes were made.</p>

<pre><code>//Declare a private variable
 private bool requiresSaving =false; 

 //Declare an event
 private void SomethingChanged(object sender, EventArgs e) 
 { 
      requiresSaving  = true; 
 } 

 //Hook up this event to the various changed events, eg
 this.txtNameDepart.TextChanged += new System.EventHandler(this.SomethingChanged); 


//Check this variable when you are closing the form
private void DepartamentEdit_FormClosing(object sender, FormClosingEventArgs e) 
{ 
if (requiresSaving) 
{ 
  .... 
</code></pre>

<p>You also need to set requiresSaving false in the saveDepart method.</p>
