LostFocus Event

Applies To

CheckBox control, ComboBox control, CommandButton control, Image control, Label control, ListBox control, OptionButton control, ScrollBar control, SpinButton control, TextBox control, ToggleButton control.

Description

Occurs when the focus is moved from an embedded ActiveX control.

Syntax

Private Sub object_LostFocus( )

object The name of an ActiveX control.

See Also

Close event, DocumentChange event, GotFocus event, New event, Open event, Quit event.

Example

This example leaves CommandButton1 disabled until the user enters a value in TextBox1.

Private Sub TextBox1_LostFocus()
    If TextBox1.Value = "" Then
        CommandButton1.Enabled = False
    Else
        CommandButton1.Enabled = True
    End If
End Sub