title: C# set CheckBox value from external class
body: <p>I have external class for do some work with my form.
  I have some error end can't handle with it.</p>
  
  <p>My first variant </p>
  
  <pre><code>mainForm.CheckBox1.Checked = true;
  </code></pre>
  
  <p>it doesn't worked with an error<br>
  Cross-thread operation not valid: Control 'CheckBox1' accessed from a thread other than the thread it was created on</p>
  
  <p>So I tried like in folow post
  <a href="https://stackoverflow.com/questions/3789773/setting-the-value-of-a-checkbox-programmatically-in-c-sharp-wpf">stackoverflow question 1</a>
  but when I wrote</p>
  
  <pre><code>mainForm.CheckBox1.IsCheked = true
  </code></pre>
  
  <p>Compiler gives an error that<br>
  The error is 'System.Windows.Forms.Control' does not contain a definition for 'IsChecked' and no extension method 'IsChecked' accepting a first argument of type 'System.Windows.Forms.Control' could be found (are you missing a using directive or an assembly reference?)</p>
  
  <p>I saw and found answer in 
  <a href="https://stackoverflow.com/questions/5548308/how-to-get-the-ischecked-property-of-a-winform-control">srackoverflow question 2</a></p>
  
  <p>But i can't casting my object because  when I write</p>
  
  <pre><code>(CheckBox)mainForm.CheckBox1.IsCheked = true
  </code></pre>
  
  <p>it gives an error Can't find name of or namespace (are you missing a using directive or an assembly reference?) for CheckBox. I have <code>using System.Windows.Forms;</code> in the beginning of class.</p>
  
  <p>I'm a beginner in C# so may your give me some suggestions what I do wrong?</p>