HandsOn Writing the Form Timer Event Procedure

1. In the Visual Basic Editor window, open the Products form.

2. The Code window shows other event procedures already written for this form. Enter the following Form_Timer event procedure below the last procedure code.

Private Sub Form_Timer() Static OnOff As Integer If OnOff Then

Me.PreviewReport.Caption = "Preview Product List" ' Me.PreviewReport.Visible = True

Else

Me.PreviewReport.Caption = "" ' Me.PreviewReport.Visible = False End If

OnOff = Not OnOff End Sub

3. Activate the Product Categories form in Design view.

4. Choose Edit | Select Form and click the Properties button on the toolbar.

5. In the Form properties sheet, click the Event tab.

6. Enter 250 in the Timerlnterval property.

7. Choose View | Form View. Notice the flashing effect of the Preview Product List button's text.

8. Close the Products form.

^^ Note: To make the entire button flash, uncomment the commented lines of code and comment the original lines. Next, open the Products form in Form view and notice that the entire button is now flashing.

Part IV

0 0

Post a comment