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.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
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.
The following code example uses the TextChanged event for a TextBox, a derived class, to determine if the contents of the 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 property is set to true. Otherwise, it is reset to false. This example requires that a TextBox control named textBox1 has been created and that a String variable named originalText has been created to store the original text for the TextBox control.
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) ' Check to see if the change made does not return the ' control to its original state. If originalText <> textBox1.Text Then ' Set the Modified property to true to reflect the change. textBox1.Modified = True ' Contents of textBox1 have not changed, reset the Modified property. Else textBox1.Modified = False End If End Sub
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.