Hi,

I created 2 window form using visual C++, I am trying to display the string typed by user in second window form's textbox.

Here is what i wrote, but the code is not working:

Form1.h

private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
tabPage1->Text=Form2().textBox1->Text;
}

Recommended Answers

All 5 Replies

Any help or advice is welcome.....I need this urgently...thanks...

System::Windows::Forms:: DialogResult dr;
dr = form2().ShowDialog();
if(dr==System::Windows::Forms:: DialogResult::OK )
{
String^ strmsg=form2().textBox1->Text;
MessageBox:: Show(strmsg);
}

I also tried this method but message box show nothing...why?

Any help??? Any advice or idea are welcome....

How come nobody have comment on this? I need this urgently..Pls help me....

Million thanks in advance.

The code looks strange (I'm in a hurry now and can't explain in details),
anyway try something like;

form2 frm;
frm.ShowDialog();
MessageBox:: Show(frm.textBox1->Text);
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.