Hi,

I created two window form (the two form call form1 and blank), when I click a button on the first form it will link to the second form. However, i face problem when I wish to change the second form text (name of the form) using the string I get from combobox. Here is what I wrote:

private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
Blank().ShowDialog();
Blank().Text=this->comboBox1->SelectedItem->ToString();
}

Why is it so?? Can someone provide me some advice....PLS and million thanks.

Regards,

Adrian

Recommended Answers

All 3 Replies

Any idea? I still not able to solve this problem....

Any suggestion? I m still waiting.....

You are misusing the form class, you instantiate two objects of the Blank class in your code.
And you need to set the window text prior to showing the form ...

private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {

    // A single instance of Blank needed in this function
    Blank BlankFrm;

    // Set the window text before you show the form
    BlankFrm.Text = this->comboBox1->SelectedItem->ToString();

    // then show the form
    BlankFrm.ShowDialog();
}
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.