Pandemonium1x
asked on
C# - Changing MDIParent propertied
Good afternoon,
I am writing a Windows form C# project and stuck on a simple issue where I am trying to change properties on a MDIParent from a child form and despite that there are no errors the property does not change. So here's the breakdown.
[On MDIParent1]
toolsToolStripMenuItem (Modifier - Public) (Currently set to enabled = false on load)
[On Child form]
Password box with the following code in the OK button.
I am writing a Windows form C# project and stuck on a simple issue where I am trying to change properties on a MDIParent from a child form and despite that there are no errors the property does not change. So here's the breakdown.
[On MDIParent1]
toolsToolStripMenuItem (Modifier - Public) (Currently set to enabled = false on load)
[On Child form]
Password box with the following code in the OK button.
if (txtPassword.Text == "password")
{
MDIParent1 parent = new MDIParent1();
parent.toolsToolStripMenuItem.Enabled = true;
MessageBox.Show("This computer has now been authorized for one session use.", "Access Granted", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.Close();
}
else
{
MessageBox.Show("You are not authorized to use this program", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
I did add a break to see if it hits that code and it does but the MDIParent object remains disabled. During my step into of the break it never goes back to anywhere that re-disables the menu item. Any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Ok, that would suggest that your form isn't actually an MDI Child form. Should it be?
ASKER
D'oh! it appears I forgot to add my form.MDIParent = this; on load of the form. You're rank does you justice sir. Thanks, it works now!
ASKER
Great work
ASKER