0

This program have multiple forms , but my problem is passing data.

This scenario below , when i run the program there will be 1 main form and another form which would look like a child form.

On my main form load i do this:

inputform = new frmLabelPNInput();
                            //frmLabelPCMain mainForm = new frmLabelPCMain(this);
                            //this.IsMdiContainer = true;
                            this.WindowState = FormWindowState.Maximized;
                           
                            inputform.TopLevel = false;
                            Controls.Add(inputform);
                            inputform.Show();
                            inputform.BringToFront();

Refer to this screenshot

When i input data on the 2nd form and click on OK button I want to be able to pass the data of that textbox without having to call another instance of the mainform because when i try to do that and display the value on a label its becoming empty string or null.

how can i pass data without it creating new instance of the form and without using the Form.Show() method and pass the data on a label on the main form?

  • Forms are no different to any other class; how would you do it elsewise? How would you give a string to a StringBuilder? How would you get a built string from a StringBuilder? – Caius Jard Feb 03 '22 at 03:37

0 Answers0