Page 430 - Microsoft Office Excel 2003 Programming Inside Out
P. 430

Part 5:  Manipulating Excel Objects
                                        Microsoft Office Excel 2003 Programming Inside Out

                             The Click and DblClick events occur when the user clicks or double-clicks the mouse. In some
                             cases, the Change event might also fire if clicking or double-clicking the control affects the
                             control’s Value.

                    The Label Control
             Chapter 19
                             The Label control allows your program to display text on the form that the user can’t modify.
                             Typically, the Label control is used to describe the contents of other controls, such as the
                             TextBox control.
                             Although the user cannot change the value of a Label control, your program can, by assigning
                             a value to the Caption property. Unlike many other controls, the Label control doesn’t have a
                             Value property because there’s nothing the user can change. However, the Label control will
                             respond to mouse clicks, triggering either the Click or the DblClick event.

                    The CommandButton Control

                             The CommandButton control displays a button that, when clicked, triggers the Click event
                             associated with the control. Another way to trigger a command button is to use the Tab key
                             to shift the focus to the command button and then press the Enter key or the Spacebar.
                             The following routine changes the text displayed on the button each time the button is
                             clicked. So if the Caption property reads “Off”, the routine will reset the value to “On”; oth­
                             erwise, the Caption property will be set to “Off”.

                             Private  Sub  CommandButton1_Click()
                             If  CommandButton1.Caption  =  "Off"  Then
                                 CommandButton1.Caption  =  "On"

                             Else
                                 CommandButton1.Caption  =  "Off"

                             End  If
                             End  Sub



















                404
   425   426   427   428   429   430   431   432   433   434   435