Adding a Navigation ToolStrip to your Forms
There are two main steps involved in adding a navigation ToolStrip to your application:
- Set the form's DisplayNavigationToolBar property
- Specify the user interface control to associate with the Navigation ToolStrip
The following sections provide details for each of these steps.
1. Setting the DisplayNavigationToolBar Property
The DisplayNavigationToolBar property has three possible settings:
- NoToolBar
- ToolBarOnMainForm
- ToolBarOnActiveForm
By default, all MM .NET forms have their DisplayNavigationToolBar property set to NoToolBar.
Displaying a Navigation ToolStrip on an MDI Parent Form
If you want the Navigation ToolStripfor a particular form to be displayed on its MDI parent form, set its DisplayNavigationToolBar property to ToolBarOnMainForm. Here's what this looks like:
By default, the navigation ToolStrip is docked to the top of the form. You can specify a different location by setting the following properties on your application's main form:
- NavToolBarDock - Specifies the navigation ToolStrip dock style. Set this to "None" if want to specify a relative position using the NavToolBarTop and NavToolBarLeft properties
- NavToolBarTop - Specifies the navigation ToolStrip Top position. Ignored unless NavToolBarDock = None
- NavToolBarLeft - Specifies the navigation ToolStrip Left position. Ignored unless NavToolBarDock = None
Displaying a Navigation ToolStrip on the Active Form
If you want the Navigation ToolStrip to be displayed directly on the form, set its DisplayNavigationToolBar property to ToolBarOnActiveForm. Here's what this looks like:
2. Specifying the Navigation User Interface Control
You need to specify an associated user interface control that can be referenced by the form's navigation ToolStrip. At runtime, when you click the navigation ToolStrip buttons, the ToolStrip calls the associated form's NavigateData method, specifying the position to navigate to (First, Prior, Next, Last). The form's NavigateData method then calls the specified navigation contol's NavigateData method.
To specify a Navigation user interface control, just store a reference to the control in the form's NavControl property in the form's constructor. You should place this code after the call to InitializeComponent since the user interface controls are not instantiated before that time.
For example, in C#:
this.NavControl = this.grdOrders;And in Visual Basic .NET:
Me.NavControl = Me.grdOrdersYou can dynamically change which is the navigation control at run time. For example, if you have a form that contains a Tab Control, you may want a different user interface control to be earmarked as the Navigation control when you are on different tabs of the Tab Control.
Using Navigation Hook Methods
The mmBusinessForm class contains two navigation hook methods that are called from the NavigateData method:- HookPreNavigate
- HookPostNavigate
Place code that you want to execute before navigation occurs in the HookPreNavigate method. If you return false from this method, navigation will not occur. Place code that you want to execute after navigation occurs in the HookPostNavigate method.
© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 04/26/18
Comment or report problem with topic
