I have a Textbox control which sometimes updated programmatically and also can be update by the user. How can I distinct between those two event? I'd like to have a "Dirty" flag set to "True" when the user changes the text.
Check Modified property of TextBox on the TextChanged event. If true, the changes were made by user, otherwise the text was changed programmatically.
Example:
void Texbox_TextChanged(object sender, EventArgs e)
{
if (((TextBox)sender).Modified)
TextboxUserInput();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With