Hi guys,
I need your help, as I have a bit of troubleshoot with the source code. When I clicked on the menuitem1 to set the menuitem1 checked to true, and when I click on the button, the messagebox is show up on my screen that says "menuitem1 checked is set to true". so when I clicked on the menuitem2 to set the menuitem1 checked as false and set menuitem2 checked as true, and when I click on the button to get messagebox that says "menuitem2 checked is set to true" but I have got the same first messagebox as I have got when I first clicked on the button. If I click the menuitem2 to get the messagebox that says "menuitem2 checked is set to true", it would not make any difference due to the source code that acting like a loop.
Here it is:
Code:
#include "StdAfx.h"
#include "Form2.h"
#include "Form1.h"
using namespace MyApplication;
System::Void Form2::button1_Click(System::Object^ sender, System::EventArgs^ e)
{
Form1 ^form1 = gcnew Form1();
if (form1->menuItem1->Checked == true)
{
MessageBox::Show("menuitem1 checked is set to true");
}
if (form1->menuItem2->Checked == true)
{
MessageBox::Show("menuitem2 checked is set to true");
}
}
Anyone who would give me advice to get this resolve, I would be much appreciate.
Thanks in advance