I want to display a message box when any person clicks on the menu item which is not enabled I have tried the following coding but it is not displaying the message box.
Coding:
private void updateFineDetailsToolStripMenuItem_Click(object sender, EventArgs e)
{
if (updateFineDetailsToolStripMenuItem.Enabled == true)
{
frmUpdateFineDetails objUpdateFineDetails = new frmUpdateFineDetails();
objUpdateFineDetails.MdiParent = this;
objUpdateFineDetails.Show();
}
else if (updateFineDetailsToolStripMenuItem.Enabled == false)
{
MessageBox.Show("Unauthorized Person");
}
}
By default I have set the enabled status to false and when the form loads I am checking whether the user is administrator, if the user is admin then this menu item will be enabled for all other user who logs into the application the above menu item has to be disabled.
Please note that the above coding does not generate any error, but it does not even display the messagebox as unauthorized person.
Can anybody help me out in performing this task?
Thanks in advance!