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

Unit 6: VB Control Structure


                     txtForecast.Text = “RAIN AHEAD”
                    Case  “FR”
                     txtForecast.Text = “SNOW AHEAD”
                 End Select
               End Sub
               [Run, type “R” and “S” into the masked text boxes, and press the button.]
























                              7: Select case is useful in defining functions that are not determined by a
                                formula. The following program assumes that the current year is not a leap
                                year:

















                              Object                   Property            Setting

                        frmSeasons           Text                Seasons
                        lblSeason            Text                Season:
                        TxtSeason
                        btnNumber            Text                Number of Days

                        txtNumDys            ReadOnly            True




                                      LOVELY PROFESSIONAL UNIVERSITY                        159
   160   161   162   163   164   165   166   167   168   169   170