M
M
mIka012021-09-21 15:07:16
C++ / C#
mIka01, 2021-09-21 15:07:16

How to pass values ​​from form1 to form2?

I'm struggling with passing values ​​from Form1 to Form2, and then Form3.

I declared an array int Fleet[20][2]after the line namespace Project {. Then I change it in different classes.
After all the operations, I click on the button that runs the code.

MyForm_serv^ form = gcnew MyForm_serv();
      form->Show();
      this->Hide();


Next, from the form, MyForm_servI want to pass the values ​​from TextBoxto the form Form3. Naturally, when the button is pressed, the code is executed.
MyForm_play^ form = gcnew MyForm_play;
    form->Show();
    this->Hide();


How in Form3 can I get the values ​​\u200b\u200bfrom Fleet[][]which is in the first Form1 and the values ​​​​from the TextBox located in Form2.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Ananiev, 2021-09-21
@mIka01

Make an array constructor in Form3 and pass the Fleet[][] array when creating the From3 form.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question