ActiveControl and ActiveForm Properties Example
◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
' This example displays the text of the active control when the form is
' clicked. Click either the text box or command button to set the focus,
' then click the form to display the active control caption within the label.
' To try this example:
' 1. Choose New Project from the File menu
' 2. Choose New Form from the File menu to create a form with:
' • Text box
' • Label
' • Command button
' 3. Press Alt+F4 to return to the programming environment
' 4. Copy the code example below to the form module
' 5. Press F5 to run the example
SUB Form_Click ()
IF TYPEOF SCREEN.ActiveControl IS TextBox THEN
Label1.Caption = SCREEN.ActiveControl.Text
ELSE
Label1.Caption = "Button: " + SCREEN.ActiveControl.Caption
END IF
END SUB