I have tried to create a variable when the user clicks a button then use an if statement inside another button inside another form to identify which button the user pressed earlier, but when I use the if statement inside another button the variable is unidentified, I have also included the other form in the code. my code inside the first form button is
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
int category = 1;
this->Hide();
MyForm3^ obj1 = gcnew MyForm3();
obj1->ShowDialog();
}
in the second form
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
if (category = 1) {
MessageBox::Show("testing", "check", MessageBoxButtons::OK, MessageBoxIcon::Hand);
}
}
it shows this error identifier "category" is undefined
Aucun commentaire:
Enregistrer un commentaire