I create 2 forms and I want each of them be able to access to each other. This is my code currently:
public partial class Form1: Form
{
public Form1()
{
InitializeComponent();
form2 = new Form2(this);
}
}
internal partial class Form2: Form
{
Form1 form1;
internal Form2(Form1 f1)
{
InitializeComponent();
form1 = f1;
}
}
(All controls, methods in form1 are public, in form2 are internal, if it helps)
The problem is I can access all controls in form1 from from2, but I can't do the same when form1 needs to access form2. In form1 I can access form2 with built-in methods such as .Show() .Focus() and .Hide(), but not elements like checkboxes and trackbars.
Did I do anything wrong when declaring forms, or this is a bug due to something else? If this is a bug can you suggest me some reasons why this bug exist; I;m confused 'cause I'm pretty sure things in InitializeComponent() were created quite correctly (in standard way, using VS designer).