Partager via


SetFocus Method

Assigns the focus to a control.

Control.SetFocus

Remarks

You cannot assign the focus to a control if the control's Enabled or Visible property is set to false (.F.), or the control's When event returns false (.F.). If the Enabled or Visible property has been set to false (.F.), you must first set it to true (.T.) before the control can receive the focus from the SetFocus method.

Once a control has the focus, any user input is directed to that control.

See Also

Enabled Property | GotFocus Event | LostFocus Event | Visible Property

Applies To: CheckBox | Column | ComboBox | CommandButton | Container Object | Control Object | EditBox | Grid | ListBox | OLE Bound Control | OLE Container Control | OptionButton | Page Object | Spinner | TextBox