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

Unit 6: VB Control Structure



                   action1
                  Case  valueList2
                   action2
                  Case  Else
                   action of last resort
               End Select
               where Case Else (and its action) is optional, and each value list contains one or more of the
               following types of items:
                  1. a literal;
                  2. a variable;

                  3. an expression;
                  4. an inequality sign preceded by Is and followed by a literal, variable, or expression;
                  5. a range expressed in the form  a To b, where a and b are literals, variables, or expressions.

                                       Evaluate
                                       selector




                                         In         Yes
                                                           Action 1
                                       value list
                                         1?
                                       No


                                         In         Yes
                                       value list          Action 2
                                        2 ?
                                       No






                                                   Yes
                                         In
                                      value list            Action 0
                                         n?
                                       No

                                      Perform
                                      action of
                                      last resort




                                      Figure 6.6:  Flowchart for a  Select Case Block.




                                      LOVELY PROFESSIONAL UNIVERSITY                        153
   154   155   156   157   158   159   160   161   162   163   164