I have a radio button on my Windows Form. How can I determine if the CheckChanged event occurred due to a user clicking or selecting the radio button vs programatically setting the event with
this.radioButtonAdd.Checked = true;
I would like some code to take a different action depending on if the user clicked the button or I raised the event myself.
Or maybe the better question is how do I handle the event when a user clicks vs when the state is changed in my code.
I think I found a pretty good answer.
All Windows Forms controls have a property called ‘Tag’. its value can be any object.
So if I want to ingore any programatic changes I can do the following:
then in the event handler: