Focus Property

Applies To

DialogSheet Object.

Description

Returns or sets the dynamic focus of the running dialog box, as a string containing the ID for the control with the focus. The control with the focus is where user keyboard input is directed, and the focus is visually indicated by a dashed rectangle around the control or around selections within the control. Read-write.

Remarks

Reading and setting this property while the dialog is not running will cause an error. While the dialog is running, setting this property will attempt to change the focus to the specified control. Not all controls will accept the focus, and the dialog manager may refuse to move the focus under certain conditions. Reading this property always returns the ID of the control with the focus.

Example

This example sets the focus to button one in the running dialog box and then displays the button name in a message box. The example should be the event procedure for a control or dialog box frame on a dialog sheet.


ActiveDialog.Focus = ActiveDialog.Buttons(1).Name
MsgBox ActiveDialog.Focus