/// <summary> /// Change the checked status of a checkbox /// </summary> /// <param name="container">The control that contains the control to change</param> /// <param name="control">The control to change</param> /// <param name="val">True to change to checked, false to change to unchecked</param> public static void SetCheckboxChecked(Control container, CheckBox control, bool val) { if (container.InvokeRequired) { SetCheckboxCheckedCallback d = SetCheckboxChecked; try { container.Invoke(d, new object[] { container, control, val }); } catch { } } else { control.Checked = val; } }
public void SetCheckboxChecked(CheckBox control, bool val) { if (control.InvokeRequired) { SetCheckboxCheckedCallback d = SetCheckboxChecked; try { Invoke(d, new object[] { control, val }); } catch (Exception) { } } else { control.Checked = val; } }