I have started out with tasks that need to communicate between different forms.
I need to understand the logic how this works and have problems to find any examples of this.
For the 2 codeexamples below, I use these to close the current Form or activate another button on the same Form.
In the 2 examples, ->this is used to identify the current Form.
For example I cant write the below code on Form1 to close Form2:
Form2->Close();
What I now wonder and logic for, is if I open Form2 from Form1 with the code below.
How is it possible to activate a button on Form2 with a button on Form1 and/or how is it possible to close Form2 from Form1.
I will be happy for any logics, links how this works.
I use this code to open Form2 from Form1.
Form2 ^form2 = gcnew Form2;
form2->Owner::set(this);
form2->Show();
The 2 code example below work when using them on Form2.
//A button will activate another buttons code (button1_Click) on the same Form.
button1_Click(this, EventArgs::Empty);
//A button can use this code to close this Form
this->Close();