Check Box Control and Parent Property Example
◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
' This example uses the Parent property and a check box control to display
' the state of a form's control.
' 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:
' • Command button
' • Check box
' 3. Set the form's AutoRedraw property to True
' 4. Press Alt+F4 to return to the programming environment
' 5. Copy the code example below to the form module
' 6. Press F5 to run the example
DECLARE SUB CheckCheck (Source AS CONTROL) ' Declare sub procedure
SUB CheckCheck (Source AS CONTROL)
IF Source.Value = 0 THEN
Source.Parent.CLS ' Clear parent form
Source.Parent.PRINT "CheckBox is Unchecked" ' Print on parent form
ELSE
Source.Parent.CLS ' Clear parent form
Source.Parent.PRINT "CheckBox is Checked" ' Print on parent form
END IF
END SUB
SUB Command1_Click ()
CheckCheck Form1.Check1 ' Call procedure in other module
END SUB