Try replacing the first line:
MAIN form2 = (MAIN)Application.OpenForms["MAIN"];
It assumes that there is a single form called "MAIN".
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have three simple interfaces Windows form. I want to send a value from the third interface it appears in the second interface .Where the second interface remains open, which is the main, and the third sub-interface is closed . The windows are opened in order from 1 to 3. Where I want the following: that the label appears on the second interface and a value is added to it.
I tried the following code and nothing works؟؟.
MAIN FORM2 = new MAIN();
FORM2.LAB_A.Visible = true;
FORM2.LAB_A.Text = DATATABLA.Rows.Count.ToString();
Try replacing the first line:
MAIN form2 = (MAIN)Application.OpenForms["MAIN"];
It assumes that there is a single form called "MAIN".