Data Types 1. Numeric Types a. Integer : Stores Integer

Embed Size (px)

Citation preview

  • 8/14/2019 Data Types 1. Numeric Types a. Integer : Stores Integer

    1/5

    Data Types

    1. Numeric Types

    A. Integer : Stores integer values in the range 32768 to +32768. Storedusing 2 bytes.

    B. Long : Stores long integers in the range 2147483648 to 2147483647.

    Stored using 4 bytes.C. Single : Stores single precision floating point numbers. It can store

    negative numbers in the range 3.40E38 to 1.40E-45 and positive

    numbers in the range 1.40E-45 to 3.40E38. They are stored using 4 bytes.D. Double : Stores double precision floating point numbers. Can store

    negative numbers in the range 1.79E308 to 4.94E324 and positive

    numbers in the range 4.94E-324 to 1.79E308. Stored using 8 bytes.

    E. Currency : Stores fixed point numbers with 4 fractional digits. Thecurrency data type can represent numbers in the range

    922337203685477.5808 to 922337203685477.5807.

    F. Byte : Data is stores as bytes and an individual byte can be accessed very

    easily. The byte type basically holds an integer in the range of 0 to 255.Bytes are frequently used to access binary files, image and sound files.

    2. String Data Type

    This type can store only text. Nearly 2 gigabytes of text can be stored in a string

    variable. This type can also hold integers.

    Fixed length strings : String variables have variable lengths. Their length dependson the values assigned to them. A fixed length string can be specified by the

    following declaration : Dim TextVar as String * 100 This variable can hold data

    upto 100 characters. If a string with less than 100 characters is assigned toTextVar then the variable is padded with spaces and if the assigned string

    exceeds the max declared length, it is truncate.

    3. Boolean Data type

    This type stores True / False values.

    4. Date Variables

    These variables store Data and Time. They are double precision numbers : the

    integer part represents date and fractional part represents the time.

    Eg Dim Jdate as DateJdate = 03/01/2005

    Jdate = 03/01/2005 10:00:00 AM

    Jdate = #03/01/2005 10:00:00 AM#

    5. Object Data Type

    An object variable is a reference to one of the VB objectsEg Dim a as CommandButton

    Set a = Command1

    a.Caption=Save

  • 8/14/2019 Data Types 1. Numeric Types a. Integer : Stores Integer

    2/5

    6. Variant Data Type

    This is a special data type that can contain any kind of data except fixed length

    String data and user defined types. A Variant can also contain the special valuesEmpty, Error, Null and Nothing. A variable declared as Variant is handled by VB

    according to the variables current contents. If an integer is assigned to it, VB

    treats it as an Integer and so on.

  • 8/14/2019 Data Types 1. Numeric Types a. Integer : Stores Integer

    3/5

    Sequence of Form Events

    Initialize : This event is fired a form is loaded. This event is normally used to initializevariables used in the form. In this event Form object is referenced.

    Load : When a form is loaded into memory, either using load statement or show method

    or by referencing a form property, the load event is triggered after Initialize event. This

  • 8/14/2019 Data Types 1. Numeric Types a. Integer : Stores Integer

    4/5

    event is fired only once for each form. Form objects properties and controls are

    referenced. VB creates the form window and its child controls.

    Activate : The activate event is fired whenever the form becomes active window i.e. the

    window is ready to accept user input. The form becomes the active window when the

    user clicks the mouse on it or Show or SetFocus method is called.

    Resize : This event is fired when the the form is resized or the window state is changed

    by minimize, maximize or restore buttons. It is also fired the first time the form isdisplayed.

    Paint : The Paint event is fired when the Forms AutoRedraw property is set to False. VB

    requests the form to refresh itself the first time it is displayed and when another windowcovers and then uncovers it.

    Deactivate : This event is fired when the form looses the focus. Exactly opposite to

    Activate event.

    QueryUnload : When the form is closed or the form Unload method is called, this eventis fired, followed by Unload event. The QueryUnload event allows the option of

    canceling the unloading of form by setting the Cancel parameter to True.

    Unload : In this event, Clean up of objects and variables is done. Any remaining objectvariable should be set to Nothing in this event.

    Terminate : This is the final event that is fired for a form. It occurs when a form is set toNothing. This event indicates that VB has removed the form and its module from

    memory.

    vbFormControlMenu 0 The user chose the Close command from

    the Control menu on the form.

    vbFormCode 1 The Unload statement is invoked from

    code.

    vbAppWindows 2 The current Microsoft Windows operating

    environment session is ending.

    vbAppTaskManager 3 The Microsoft Windows Task Manager isclosing the application.

    vbFormMDIForm 4 An MDI child form is closing because theMDI form is closing.

    vbFormOwner 5 A form is closing because its owner is

    closing.

  • 8/14/2019 Data Types 1. Numeric Types a. Integer : Stores Integer

    5/5