954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Help!! Can't change a window form text

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

Adrian99420
Light Poster
42 posts since Feb 2008
Reputation Points: 10
Solved Threads: 0
 

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

Adrian99420
Light Poster
42 posts since Feb 2008
Reputation Points: 10
Solved Threads: 0
 

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

Adrian99420
Light Poster
42 posts since Feb 2008
Reputation Points: 10
Solved Threads: 0
 

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();
}
mitrmkar
Posting Virtuoso
1,809 posts since Nov 2007
Reputation Points: 1,105
Solved Threads: 395
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You