Page 80 - Open Soource Technologies 304.indd
P. 80

Event Driven Programming



                            6. Which cursor type should you use to populate the combo boxes?
                                (a) ForwardcOnly            (b) Dynamic

                                (c) KeySet                  (d) Static
                            7. You create a new form and immediately place on it a text box, naming it txtLastName. Next,
                               you place another text box, naming it txtFirstName. After running the application a few
                               times, you decide you would like to change the tab order so that the cursor initially appears
                               in txtFirstName. What is the best way to do this?

                                (a) Add txtFirstName.SetFocus to the
                                   Form_Load() event procedure.

                                (b) Set txtFirstName.TabIndex = 0.
                                (c) Set txtFirstName.TabIndex = 1.
                                (d) Set txtLastName.TabStop = False.

                            8. In designing your company’s order entry system, you’ve decided to use the text box control
                               for most of the data input. One of the validation rules is to require all purchasing codes
                               to be entered in uppercase. Which two attributes of the text box control would you use to
                               enforce this rule?

                                (a) KeyPress property       (b) KeyDown event
                                (c) KeyPress event          (d) UpperCase function
                                (e) UCase function           (f) KeyAscii argument

                            9. The data entry form that you are designing will have some very strict field-level validation
                               to ensure that accounting and other business codes are correct as you tab from field to field.
                               Which text box event should you use to enforce this validation?
                                (a) KeyPress event          (b) Change event

                                (c) LostFocus event         (d) Validate event
                           10. What does the following event procedure accomplish?
                               Private Sub cmdList_Click()

                               Dim frmTest As Form
                               Dim ctrTest As Control
                               For Each frmTest In Forms
                               For Each ctrTest In frmTest.Controls
                               MsgBox frmTest.Name & “ : “ & ctrTest.Name

                               Next
                               Next
                               End Sub



                          74                     LOVELY PROFESSIONAL UNIVERSITY
   75   76   77   78   79   80   81   82   83   84   85