Windows Forms: Adding Localization Menu Bars



Note: If you initially created your Windows Forms application with MM .NET version 1.2 or later, you can skip this step, because these versions of the New Project Wizard automatically creates the localization menu bars for you.

In Windows Forms applications, you need to add two menu bars to your application--one bar that launches the Language maintenance form, and another bar that allows the user to turn Localize Setup mode on and off. The following instructions show how to add this menu bars to your application menu. You can alter these instructions to add the new menu bars to other menu pads if so desired.

Localize Setup Menu Bar

Here are the steps you need to take to add a File | Localize Setup... menu bar to your application's menu:

  1. If it does not already exist, add a using or Imports reference to OakLeaf.MM.Main at the top of your MainForm.cs or MainForm.vb file.

    In C#:

    using OakLeaf.MM.Main;

    In VB .NET:

    Imports OakLeaf.MM.Main

  2. In the Solution Explorer, double-click the MainForm.cs or MainForm.vb file

  3. Click on the File menu pad to expand it, then right-click the Security Setup... menu bar and select Insert New from the shortcut menu. Enter the text "Localize Setup"

  4. Go to the Properties Window and change the name of the menu bar to FileLocalizeSetupBar.

  5. Double-click the menu bar. This creates a new event handler method called FileLocalizeSetupBar_Click. Add the following code to this method:

    In C#:

    private void FileLocalizeSetupBar_Click(object sender, System.EventArgs e)
    {
    	if (this.FileLocalizeSetupBar.Checked)
    	{
    		this.FileLocalizeSetupBar.Checked = false;
    		mmAppDesktop.LocalizeSetupMode = false;
    		this.HideLocalizeToolBar();
    	}
    	else
    	{
    		this.FileLocalizeSetupBar.Checked = true;
    		mmAppDesktop.LocalizeSetupMode = true;
    		this.ShowLocalizeToolBar();
    	}
    }

    In VB .NET:

    ' File | Localize Setup menu bar Click event handler
    Private Sub FileLocalizeSetupBar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FileLocalizeSetupBar.Click
        If Me.FileLocalizeSetupBar.Checked Then
            Me.FileLocalizeSetupBar.Checked = False
            mmAppDesktop.LocalizeSetupMode = False
            Me.HideLocalizeToolBar()
        Else
            Me.FileLocalizeSetupBar.Checked = True
            mmAppDesktop.LocalizeSetupMode = True
            Me.ShowLocalizeToolBar()
        End If
    End Sub

  6. If you are using MM .NET Security in your application, you may want to secure the menu bar and only allow specific users or roles to localize the application. For details, see the Help topic Securing Windows Forms Menus.

Now at run time, when a user selects the File | Localize Setup menu bar, the Localization toolbar is displayed in the main application window:

If a user selects File | Localize Setup... from the menu bar again, the Localization toolbar is removed from the main application window.

Languages Menu Bar

Here are the steps you need to take to add a Languages menu bar to your application's menu:

  1. Click on the menu pad you want to add the Languages menu bar to (Lists, for example).

  2. Either insert a new menu bar (as shown in the previous step), or simply click in the empty menu bar that says [Type Here].

  3. Go to the Properties Window and change the name of the menu bar to ListsLanguagesBar.

  4. Double-click the new menu bar. This creates a new event handler method called ListsLanguagesBar_Click. Add the following code to this method:

    In C#:

    private void ListsLanguagesBar_Click(object sender, System.EventArgs e)
    {
    	mmAppDesktop.FormMgr.Show(new mmLanguageForm(), this);
    }

    And in VB .NET:

    Private Sub ListsLanguagesBar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListsLanguagesBar.Click
         mmAppDesktop.FormMgr.Show(New mmLanguageForm, Me)
    End Sub

Now at run time, the user sees a Languages menu bar that launches the Language maintenance form.


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