Changing the text of a label
Jan 22, 2013 at 10:52pm UTC
I've been trying to work out how to change the text on a windows form label to a variable from another class.
What should happen
The user inputs Text into a field in form1
1 2 3 4 5
public : System::Void textBox1_TextChanged(System::Object^ sender, System::EventArgs^ e) {
NumOfNodes = System::Convert::ToInt32(this ->textBox1->Text);
testX = textBox1->Text;
//NumOfNodes = this->textBox1->Text;
}
This is then passed through the main class into the class for form2
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Form1 f1obj;
System::String^ NumOfNodes;
if (f1obj.testX == "0" )
{
NumOfNodes = "Testing" ;
}
else
{
NumOfNodes = f1obj.testX;
}
Form2 f2obj;
int solveMethod = f2obj.solveMethod;
bool solving = f2obj.solving;
f2obj.NumOfNodes = NumOfNodes;
And at this point I need to make the text of a a certain label = Form2's NumOfNodes Variable. I Presummed it would be as simple as
this ->label6->Text = L NumOfNodes;
however that doesn't work.
Can anyone help ?
Last edited on Jan 22, 2013 at 10:52pm UTC
Topic archived. No new replies allowed.