I have external class for do some work with my form. I have some error end can't handle with it.
My first variant
mainForm.CheckBox1.Checked = true;
it doesn't worked with an error
Cross-thread operation not valid: Control 'CheckBox1' accessed from a thread other than the thread it was created on
So I tried like in folow post stackoverflow question 1 but when I wrote
mainForm.CheckBox1.IsCheked = true
Compiler gives an error that
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?)
I saw and found answer in srackoverflow question 2
But i can't casting my object because when I write
(CheckBox)mainForm.CheckBox1.IsCheked = true
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 using System.Windows.Forms;
in the beginning of class.
I'm a beginner in C# so may your give me some suggestions what I do wrong?