c# - Displaying MessageBox when disabled menu item is clicked -


I when anyone menu items which have not been able I display a message box on the tried following coding Want to do this, but this message box is not showing

coding :.

  private void updateFineDetailsToolStripMenuItem_Click (object sender, EventArgs e) {if (updateFineDetailsToolStripMenuItem.Enabled == true) {frmUpdateFineDetails objUpdateFineDetails = new frmUpdateFineDetails (); ObjUpdateFineDetails.MdiParent = This; ObjUpdateFineDetails.Show (); } And if (updateFineDetailsToolStripMenuItem.Enabled == incorrect) {message box. Show ("unauthorized person"); }}  

is set to enable status by default I'm wrong and when the form loads I user administrator whether, if the user administrator check will enable this menu item For all other user who logs in the application above the menu item is disabled.

Please note that the above coding does not cause any errors, but it also does not display messagebox as unauthorized person.

Can anyone help me out before doing this task?

Thank you!

After

The whole idea of ​​disabling a menu item or a button is to prevent the user from communicating with it. . Normally the control will also be provided in a way so that it becomes clear to the user. For example, whether you're a user or administrator based, want to prevent the user to perform certain actions, you can use one of three methods:

  • Control maintain efficient and unauthorized inform
  • hide control

Later in the two cases, there is no interaction, because the user can not open the command. I usually like to hide the command to go, if it is based on the role of access (which means that if I do not have access to the command when the application starts, so any time Will not be the point during the run of it), or it is inactive if the availability of the command is related to data status .


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -