Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
SetFocus Method
See Also Example Applies To
Moves the focus to the specified control or form.
Syntax
object**.SetFocus**
The object placeholder represents an object expression that evaluates to an object in the Applies To list.
Remarks
The object must be a Form object, MDIForm object, or control that can receive the focus. After invoking the SetFocus method, any user input is directed to the specified form or control.
You can only move the focus to a visible form or control. Because a form and controls on a form aren't visible until the form's Load event has finished, you can't use the SetFocus method to move the focus to the form being loaded in its own Load event unless you first use the Show method to show the form before the Form_Load event procedure is finished.
You also can't move the focus to a form or control if the Enabled property is set to False. If the Enabled property has been set to False at design time, you must first set it to True before it can receive the focus using the SetFocus method.