Specifying the Control to Receive Focus

Using the SetFocus Method

The mmBaseForm class has a SetFocus method that is used to set focus to the specified control. If a control is not on a page of a TabControl, you can simply call its Focus method to set focus to it. However, if it's on a TabControl, you must first select the page on which it resides (if it's not the currently selected page) and then set focus to it. The SetFocus method does all of this for you. It automatically detects if the specified control is on a TabControl page, and if so, it makes the page the currently selected tab (if it's not already), and then sets focus to the control.

Here's an example of how to call this method:

In C#:

this.SetFocus(this.txtOrderID);

In VB .NET:

Me.SetFocus(Me.txtOrderID)

Using MM .NET's "Focus" Properties

MM .NET forms have several properties you can use to specify which control receives focus when particular form events occur:

You can select a user interface control from the associated combo box of each property to specify which user interface control gets focus after a cancel, delete, retrieval, form load, new, or save operation occurs.


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