I have a problem while using UltraCheckBox. I hav placed a checkbox on the form FORM1, and when i check (enable) this checkbox, a property of my object(IsChecked) sets to TRUE and another form FORM2 opens up. Now in this, all my code is placed on _CheckedChanged event.
Now again when i come back to this FORM1 (in edit mode), and my property IsChecked is already set to TRUE, then i m setting this Checkbox's checked to true. Now here i m not manually checking the checkbox, but my code is doing so. My code is cehcking the checkbox and FORM2 loads. This behavior is quite natural, because ultimately _CheckedChanged event is again firing up, leading my FORM2 to load that i really dont want to happen.
All i need is to distinguish between the manual check and code check( when my code is setting its checked property to tru), becos at the time of manual check i need FORM2 to load, but at the time of code check i dont need FORM2. Can u pls tell me some way, where i can differentiate between manual and code checking of a checkbox.
[b]UltraCheckBox, Manual Check Vs Code Check[/b]
[b]UltraCheckBox, Manual Check Vs Code Check[/b]
The simpliest way to prevent CheckedChanging event from firing while you need to process manual checking/unchecking of the CheckBox is to simply disconnect the event handler from the event. After setting the state of the component you should again connect event to its handler.
Thank you.
Code: Select all
CheckBoxControl1.CheckedChanged -= new EventHandler(CheckBoxControl1_CheckedChanged);
CheckBoxControl1.Checked = !CheckBoxControl1.Checked;
CheckBoxControl1.CheckedChanged += new EventHandler(CheckBoxControl1_CheckedChanged);