There is no built-in mechanism for this. However, you can use the flag.
bool updatingUI = false; private void UpdatePreview(object sender, EventArgs e) { if (updatingUI) return; txtPreview.Text = "The user has changed one of the options!"; }
Then, when you update the user interface from your code:
updatingUI = true; checkBox1.Checked = true; updatingUI = false;
If you want to override the solution, you can use something like this:
private void UpdateUI(Action action) { updatingUI = true; action(); updatingUI = false; }
And use it as follows:
UpdateUI(()=> { checkBox1.Checked = true; });
Adam robinson
source share