I want to access members of Form1 using Form2 . For example, I want to change the color of the "panel1" that is inside the "Form1" to the black color:
This is how I'm doing
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void Form2_Load(object sender, EventArgs e)
{
Form1 form1 = new Form1();
form1.panel1.BackColor = Color.Black;
}
}
However, it is impossible to do this, because the control "panel1" does not appear within the Form1
class "instantiated".