Using C++/CLI--
Is there a good way to return a value (not a DialogResult) from a form shown as a dialog?

I plan to use Invoke on a method to update the previous form from within the dialog, if not.

I also would like to thank the fine members of Daniweb for being so helpful, as always.

Here is an example where Form1 copies the text from Form2 after Form2 closes. In Form2.h I added a public method that return the String from its textBox1 text control. Similar technique can be used for all of the controls on Form2.

Form2.h

public:
        String^ GetTextBoxString() { return textBox1->Text; }

Form1.h This method is envoked when a button control is clicked.

private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
                 Form2^ f2 = gcnew Form2;
                 this->Hide();
                 f2->ShowDialog();
                 this->textBox1->Text = f2->GetTextBoxString();
                 this->Show();
             }
    };

Edited 5 Years Ago by Ancient Dragon: n/a

This question has already been answered. Start a new discussion instead.