Creating a Maintenance Form
You can use the mmMaintenanceForm class as a template for your Windows Forms maintenance forms. As shown below, the form contains a Tab Control with two pages, List, and Properties. The List page contains New, Delete, and Close buttons:

If you prefer a maintenance form with your own look and feel, you can simply subclass the mmBusinessForm class and design your own custom form.
Creating a Custom Maintenance Form
Note: These instructions assume you have already created a business object you can use to insert, update, and delete records associated with the maintenance form. See the Help topic Using the MM .NET Business Layer Generator for details on creating your business layer.
- Right-click your Windows Forms project and select Add | New Item... from the shortcut menu.
- In the Categories pane of the Add New Item dialog, select MM .NET. In the Templates pane select the MM .NET Business Maint Form template:
- In the Name text box specify the name you want to give your new form, then click Add.
- Double-click the form in the Solution Explorer so it is displayed in design mode. You should now see a TabControl on the form, with the List and Properties pages as shown in the diagram at the beginning of this topic (you may need to resize the form).
- Go to the Visual Studio Properties Window and change the Text property to the caption you want displayed for the form at run time.
Adding a Business Object to the Form
- Right-click the form in design mode and select View Code from the shortcut menu.
Add a reference to your business object's namespace to the top of the form's code file.
For example, in C#:
using MyCompany.MyProduct.Business;
And in VB .NET:
Imports MyCompany.MyProduct.Business
- Add a new field to your form class to contain a reference to your form's primary business object.
For example, in C#:
public class mmRolesForm : mmMaintenanceForm { protected Role oRole;And in VB .NET:
Public Class mmRolesForm Inherits mmMaintenanceForm Protected oRole As Role - Add code to the form's constructor to instantiate and register your business object as the form's primary business object (for more information, see the topic Registering Business Objects with a Windows Form)
For example, in C#:
this.oRole = (Role)this.RegisterPrimaryBizObj(new Role());
And in VB .NET:
Me.oRole = CType(Me.RegisterPrimaryBizObj(New Role()), Role)
- Add code to the form's constructor to retrieve records to display in the DataGridView when the form is first displayed. This code should be placed in the constructor after the call to InitializeComponent so all user interface controls are instantiated before the data is retrieved for display.
For example, in C#:
public mmRolesForm() { this.oRole = (Role)this.RegisterPrimaryBizObj(new Role()); // // Required for Windows Form Designer support // InitializeComponent(); // Retrieve all roles this.oRole.GetAllRoles(); }And in VB .NET:
Public Sub New() MyBase.New() ' Instantiate and register the business object Me.oRole = CType(Me.RegisterPrimaryBizObj(New Role()), Role) 'This call is required by the Windows Form Designer. InitializeComponent() ' Retrieve all Roles Me.oRole.GetAllRoles() End Sub
Adding a DataGridView to the List Page
- Click on the List page (on the page itself, not on the tab at the top). Go to the Visual Studio Toolbox, then drag and drop an mmDataGridView control onto the List page. Resize the DataGridView and form to suit your needs:

- In the Visual Studio Properties Window, change the Name of the data grid to something descriptive of its use. For example: grdRoles.
- In the Properties Window, select the BindingSource property. Click the ellipses button [...] next to the property which launches the Binding Source Selection dialog. Select your business object from the list and click OK:

This stores the business object name in the DataGridView's BindingSource property.
- To specify the DataGridView as your form's primary navigation control set the form's NavControl property accordingly in the forms constructor.
For example, in C#:
this.NavControl = this.grdRoles;
And in VB .NET:
Me.NavControl = Me.grdRoles
- If you want to set up columns in the DataGridView, see the topic Working with the mmDataGridView.
Adding User Interface Controls to the Properties Page
- Select the Properties page in the maintenance form (the actual page, not just the tab), then drag and drop MM .NET user interface controls from the Visual Studio Toolbox. For example:

After dropping the controls on the form, go to the Properties Window and change the Name property of each control to something descriptive of its use. Also, change the text of all labels.
- In this step you data bind all input controls which involves setting the binding properties. For text boxes, this means setting the BindingSource and BindingSourceMember property. There are additional properties to be set on list boxes and combo boxes. For information on setting these properties using the MM .NET builders, see the topic (and subtopics) Data Binding MM .NET Windows Forms Controls.
- Drag and drop an instance of the mmButtonSave and mmButtonCancel controls on the bottom of the Properties page:

Rename these buttons to something more descriptive such as btnSave and btnCancel.
- If you want to set focus to the List page when the Save and Cancel buttons are clicked, double-click the Save and Cancel buttons and add the following code in their associated Click event handlers.
In C#:
private void btnSave_Click(object sender, System.EventArgs e) { this.TabControl.SelectedTab = this.ListPage; } private void btnCancel_Click(object sender, System.EventArgs e) { this.TabControl.SelectedTab = this.ListPage; }And in VB .NET:
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click Me.TabControl.SelectedTab = Me.ListPage End Sub Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click Me.TabControl.SelectedTab = Me.ListPage End Sub
Specifying the Control to Receive Focus On Creation of a New Record
To specify the control that receives focus when the new button is clicked, select the form in design mode, and go to the Properties Window. In the FocusOnNewControl property, select the control to receive focus:
Launching Your New Maintenance Form from the Main Menu
If you want to launch your new maintenance form from the main menu, follow the instructions in the topic Launching a Form from the Main Menu.Adding a Navigation Toolbar to the Maintenance Form
If you want to add a navigation toolbar to your maintenance form (either directly on the form, or on the main desktop form), see the Help topic Adding a Navigation Toolbar to your Forms.Displaying the Current Record in the Form Title
If you want to display a description of the current record in the form title, see the Help topic Displaying a Record Description in the Form Title for details.Turning Off Automatic New Rows
If you want to turn off the ability to automatically add new rows by pressing the down arrow key, see the section "Turning Off Automatic New Rows with the Down Arrow Key" under the Help topic Working with mmDataGrid.© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 04/26/18
Comment or report problem with topic
