I have a bunch of controls on a form and all of their "change" events point to the same event handler. Some of these are txtInput1's TextChanged, chkOption1's CheckedChanged, and cmbStuff1's SelectedIndexChanged. Here is the event handler:
private void UpdatePreview(object sender, EventArgs e)
{
// TODO: Only proceed if event was fired due to a user's clicking/typing, not a programmatical set
if (sender.IsSomethingThatTheUserDid) // .IsSomethingThatTheUserDid doesn't work
{
txtPreview.Text = "The user has changed one of the options!";
}
}
I would like the if statement to only run when a user changes the TextBox text or clicks a checkbox or whatever. I don't want it to happen if the text or checkbox was changed by some other part of the program.