Tuesday, April 26, 2011

How Names are Used in Object Events




    The names you assign to objects are used by Visual Basic to set up a framework of event-driven procedures for you to add code to.  The format for each of these subroutines (all object procedures in Visual Basic are subroutines) is:

Sub ObjectName_Event (Optional Arguments)
            .
            .
End Sub

    Visual Basic provides the Sub line with its arguments (if any) and the End Sub statement.  You provide any needed code.


In the Caption properties of the three command buttons, notice the ampersand (&).  The ampersand precedes a button's access key.  That is, in addition to clicking on a button to invoke its event, you can also press its access key (no need for a mouse).  The access key is pressed in conjunction with the Alt key.  Hence, to invoke 'Begin Timing', you can either click the button or press Alt+B.  Note in the button captions on the form, the access keys appear with an underscore (_).

No comments:

Post a Comment