Example #1
0
 public void SetChecked(CheckBox checkbox, bool state)
 {
     if (checkbox.InvokeRequired)
     {
         SetCheckedCallback d = new SetCheckedCallback(SetChecked);
         checkbox.Parent.Invoke(d, new object[] { checkbox, state });
     }
     else
     {
         checkbox.Checked = state;
     }
 }
Example #2
0
 private void check(CheckBox chBox, bool ch)
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     try
     {
         #region Set checked in Safely
         if (chBox.InvokeRequired)
         {
             SetCheckedCallback d = new SetCheckedCallback(check);
             chBox.Invoke(d, new object[] { chBox, ch });
         }
         else
         {
             chBox.Checked = ch;
         }
         #endregion
     }
     catch { }
 }