Hi,
I am new to C++ and I'm sure that this is an easy problem to someone who knows C++. I am trying to pass text from a textbox to another textbox on a different form.
I would really appreciate any feedback on my code.
Form 6 Code

private: System::Void button4_Click(System::Object^  sender, System::EventArgs^  e) {
Form6::Hide();
Form7 myForm;
this->textBox2->Text = myForm.str1;
if(myForm.ShowDialog() == System::Windows::Forms::DialogResult::OK)

{
   //Do stuff
}

Form 7 Code

public: Form7::String^ str1;
private: System::Void textBox1_TextChanged(System::Object^  sender, System::EventArgs^  e) {
				 this->textBox1->Text = str1;
				 this->Visible=true;
			 }
//--- Form 7
...
public: System::String ^str1;
...

//--- Form 6
...
Form7 myForm;
my_form.str1 = "Hello world";
...
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.