NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

TextBoxBase.Modified

Gets or sets a value that indicates that the text box control has been modified by the user since the control was created or its contents were last set.

[Visual Basic]
Public Property Modified As Boolean
[C#]
public bool Modified {get; set;}
[C++]
public: __property bool get_Modified();
public: __property void set_Modified(bool);
[JScript]
public function get Modified() : Boolean;
public function set Modified(Boolean);

Property Value

true if the control's contents have been modified; otherwise false. The default is false.

Remarks

You can use this property to determine if the user has modified the contents of the text box control. You can also set this property in code to indicate that changes were made to the text box control by the application. This property can be used by validation and data saving methods to determine if changes were made in a text box control so the changed contents can be validated or saved.

Example [C#]

The following example uses the System.WinForms.TextBoxBase.TextChanged event of TextBox, a derived class, to determine if the contents of a TextBox control have changed since the control was filled with data. The example uses a string to store the original contents of the control and compares it against the contents of the TextBox to determine if the contents have changed. If the contents have changed, the Modified property is set to true. Otherwise, it is reset to false. This example assumes that a TextBox control named Text1 has been created and that a string named OriginalText has been created to store the original text for the TextBox control.

[C#]

private void Text1_TextChanged(object sender, EventArgs e)
{
   /* Check to see if the change made does not return the
      control to its original state. */
   if (OrinalText != Text1.Text)
      // Set the Modified property to true to reflect the change.
      Text1.Modified = true;
   else
      // Contents of Text1 has not changed, reset the Modified property.
      Text1.Modified = false;
}

See Also

TextBoxBase Class | TextBoxBase Members | System.WinForms Namespace