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

Event Driven Programming



                                                                             Chr
                          number to
                          other bases
                                                                    Format. L Case. U Case
                          Number to
                          string
                                                                    Data Serial. Data Value
                          One data
                          type to
                                                                          Hex. Oct
                          another
                          Data to day.
                                                                         Format, Str
                          month,
                          weekday, or
                                                     CBool, CByte, CCur, CDate, CDbl, CDec, CInt, CIug, CSug,
                          year
                                                                   C Str, CVar, CVErr, Fix Iut
                          Time to
                          hour
                                                                    Day, Month, Week, year
                          minute, or
                          second
                          string to
                          ASCII value                                 Hour, Minute, Second

                          String to                                           Ass
                          number                                              Val
                          Time to
                          serial                                     Time Serial, Time Value
                          number




                                        Note that you can cast variables from one type to another in Visual Basic using
                                        the functions  CBool(),  CByte(), and so on.



                          4.3.4 Setting Variable Scope
                          You have just finished creating a new dialog box in your greeting card program, and it is a
                          beauty. However, you realize there is a problem: the user enters the new number of balloons
                          to display the greeting card in  TextBox1  of the dialog box, but how do you read that value in
                          the rest of the program when the user closes the dialog box?
                          It is tempting to set up a global variable,  intNumberBalloons, which you fill in the dialog box
                          when the user clicks on the OK button. That way, you will be able to use that variable in the
                          rest of the program when the dialog box is closed. But in this case, you should resist the





                          84                     LOVELY PROFESSIONAL UNIVERSITY
   85   86   87   88   89   90   91   92   93   94   95