TakeFocusOnClick Property

TakeFocusOnClick Property

See Also         Example         Applies To        

Specifies whether a control takes the focus when clicked.

Syntax

object.TakeFocusOnClick [= Boolean]

The TakeFocusOnClick property syntax has these parts:

Part Description
object Required. A valid object.
Boolean Optional. Specifies whether a control takes the focus when clicked.

Settings

The settings for Boolean are:

Value Description
True The button takes the focus when clicked (default).
False The button does not take the focus when clicked.

Remarks

The TakeFocusOnClick property defines only what happens when the user clicks a control. If the user tabs to the control, the control takes the focus regardless of the value of TakeFocusOnClick.

Use this property to complete actions that affect a control without requiring that control to give up focus. For example, assume your form includes a TextBox and a CommandButton that checks for correct spelling of text. You would like to be able to select text in the TextBox, then click the CommandButton and run the spelling checker without taking focus away from the TextBox. You can do this by setting the TakeFocusOnClick property of the CommandButton to False.