Returns the control that has the focus. When a form is referenced, ActiveControl specifies the control that would have the focus if the referenced form were active. Not available at design time; read-only at run time.
object.ActiveControl
The object placeholder represents an object expression that evaluates to an object.
You can use ActiveControl to access a control's properties or to invoke its methods: For example, Screen.ActiveControl.Tag = "0"
. A run-time error occurs if all controls on the form are invisible or disabled.
Each form can have an active control (Form.ActiveControl
), regardless of whether or not the form is active. You can write code that manipulates the active control on each form in your application even when the form is not the active form.