Step 8: Displaying a Security Setup Form

The Framework contains an mmSecuritySetupForm class that allows you to maintain user and roles security settings:

You can subclass this Framework-level form and customize it as needed.


Note: When you run the MM .NET Windows Forms New Project wizard, a File | Security Setup menu bar is automatically added to your main form's menu. If you have removed this menu bar, follow the steps below to create a new one.


  1. Add a new menu bar named FileSecuritySetupBar to your application's main menu for launching the Security Setup form. For details, see the Help topic Launching a Form from the Main Menu.

  2. Double-click on the menu bar in design mode and add the following code to the menu bar's Click event handler:


    Note: The following code contains a reference to a menu bar named FileSecuritySetupBar. If you have named your menu bar something else in step 1, replace all references to FileSecuritySetupBar with your menu bar name. This code also references a menu extender named mmMenuExtender, and a main menu named MenuStrip. If you have named these something different, then change the code below accordingly.

    In C#:

    private void FileSecuritySetupBar_Click(object sender, System.EventArgs e)
    {
    	if (this.FileSecuritySetupBar.Checked)
    	{
    		this.FileSecuritySetupBar.Checked = false;
    		mmAppDesktop.SecuritySetupMode = false;
    		this.mmMenuStripExtender.SetMenuSecuritySetup(this.MenuStrip.Items, false);
    	}
    	else
    	{
    		this.FileSecuritySetupBar.Checked = true;
    		mmAppDesktop.SecuritySetupMode = true;
    		this.mmMenuStripExtender.SetMenuSecuritySetup(this.MenuStrip.Items, true);
    	}
    }

    And in VB .NET:

    Private Sub FileSecuritySetupBar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FileSecuritySetupBar.Click
        If Me.FileSecuritySetupBar.Checked Then
            Me.FileSecuritySetupBar.Checked = False
            mmAppDesktop.SecuritySetupMode = False
            Me.mmMenuStripExtender.SetMenuSecuritySetup(Me.MenuStrip.Items, False)
        Else
            Me.FileSecuritySetupBar.Checked = True
            mmAppDesktop.SecuritySetupMode = True
            Me.mmMenuStripExtender.SetMenuSecuritySetup(Me.MenuStrip.Items, True)
        End If
    End Sub

Securing the Security Setup Menu Bar

You should definitely make the Security Setup menu bar secure so only users with special rights can launch the User Security Setup form. To do this, see the Help topic Securing Windows Forms Menus.


Note: In order to access the Security Setup menu bar at run time, you need to add at least one user to the UserSecurity table or one role to the RoleSecurity table for the Security Setup menu bar.


See also:
Step 9: Assigning Control IDs to Secure Controls


© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 04/26/18
Comment or report problem with topic