public static void SetCheckbox(Form form, Control ctrl, bool value) { if (ctrl.InvokeRequired) { SetCheckboxCallback d = new SetCheckboxCallback(SetCheckbox); form.Invoke(d, new object[] { form, ctrl, value }); } else { if (ctrl is CheckBox) { ((CheckBox)ctrl).Checked = value; } } }
private void SetCheckbox(CheckBox ctl, bool val) { if(ctl.InvokeRequired) { SetCheckboxCallback d = new SetCheckboxCallback(SetCheckbox); this.Invoke(d, new object[] { ctl, val }); } else { ctl.Checked = val; } }