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

Unit 4: VB Programming Fundamentals



               4. Boolean
               Boolean data types hold either a true or false value. These are not stored as numeric values and
               cannot be used as such. Values are internally stored as -1 (True) and 0 (False) and any non-zero
               value is considered as true.

               5. Variant
               Stores any type of data and is the default Visual Basic data type. In Visual Basic if we declare
               a variable without any data type by default the data type is assigned as default.

               4.1.1 Visual Basic Data Types

                                      Data Type              Suffix

                                      Boolean                None
                                      Integer                %
                                      Long (Integer)         &
                                      Single (Floating)      !
                                      Double (Floating)      #
                                      Currency               @
                                      Date                   None
                                      Object                 None
                                      String                 $
                                      Variant                None

               4.1.2 Verifying Data Types

               You can change a variables type with  ReDim  in Visual Basic, assign objects to variables using
               Set, and even convert standard variables into arrays. For these and other reasons, Visual Basic
               has a number of data verification functions, which appear in next page and you can use these
               functions to interrogate objects and determine their types.
               Verification
               function.   Dose This
               Function
               Is  Array  ()                   Returns True if passed an array
               Is  Date()                       Returns True if passed a data
               Is Empry()                Returns True if  passed variable is uninitialized
               Is Error()                    Returns True if passed an error value
               Is Missing()  Returns True  if value was not passed for specified parameter in procedure call
               Is Null()                         Returns True if passed NULL
               Is Numeric()                 Returns True if passed a numeric value
               Is  Object()                    Returns True if passed an object






                                      LOVELY PROFESSIONAL UNIVERSITY                         79
   80   81   82   83   84   85   86   87   88   89   90