Beruflich Dokumente
Kultur Dokumente
ANDHRA PRADESH
Name : K SREE RAMACHARYULU
Designation : LECTURER
Branch : Commercial & Comp. Practice
Institute : Govt. Polytechnic, SRIKAKULAM
Year / Semester :V
Subject : Visual Basic-I
Subject Code : CCP-503
Duration : 50 Minuets
Topic : Programming Fundamentals
Sub-topic : VB Environment, Basics of VB
Programming Fundamentals
Teaching Aids : PPT, Animation clips and Images
CCP503.23 1
Objectives
On completion of this period, you would be able to
understand about
CCP503.23 2
Structure
Range of Variables
CCP503.23 3
Recap
Definition of Variable
Declaration of variables
CCP503.23 4
Different types of variables supported
by VB & Their classification
The VB recognizes the following six types of
variables:
1. Numeric Variables
2. String Variables
3. Boolean Variables
4. Date Variable
5. Object Variables
6. Variant Variable
CCP503.23 5
Classification of Variables in brief
CCP503.23 7
Numeric Variables and its Range of Values
CCP503.23 8
Numeric Variables and its Range of Values
Stoage
Type Range of Values
CCP503.23 9
General syntax of the Variable declaration
In order to declare any type of variable the following syntax
is used
Dim <variable Name> as <variable data type>
Examples:
Dim count as integer
Dim Days In Country as long
Dim length as single
Dim area as double
Dim volume as double
Dim area as double, count as integer (multiple
declaration)
CCP503.23 10
Non Numeric Data Type
CCP503.23 11
Non Numeric Data Type
CCP503.23 12
String Data Type
This data type holds only text
CCP503.23 13
Boolean Data Type
It stores True/False values
VB allocates 2bytes to this data type
They are,in essence,integers that take the value –
1 (for True) and 0 ( for False)
Examples:
CCP503.23 14
Date Data Type
Date & time values are stored internally in a special format,
but we don’t need to know the exact format
CCP503.23 15
Date Data Type
Example:
dim expiration as date
expiration = “21/02/2008”
expiration = “22:30:15 PM”
expiration = “21/02/2008 22:30:15PM”
expiration = “#21/02/2008 22:30:15PM#”
CCP503.23 16
Variant Data Type
It is more flexible type
CCP503.23 17
Byte Data Type
Actually none of numeric types stored in a single
byte
Sometimes, data is stored as bytes, and we must be
able to access individual bytes
Byte type holds basically an integer in range 0 to 255
CCP503.23 18
Byte Data Type
CCP503.23 19
Object Data Type
An Object variable refers to one of the VB’s objects
Example:
A form has two command buttons on it,
command1 & command2.
We can declare two object variables as
Dim a as commandbutton
Dim b as commandbutton
CCP503.23 20
Continuation…
CCP503.23 21
Summary
CCP503.23 22
Quiz
1. The storage size of the single data type is --------
C. One Byte
D. Two Bytes
E. Three Bytes
F. Four Bytes
CCP503.23 23
Quiz continuation
2. If we assign text exceeding max Length to a
string data type
CCP503.23 24
Quiz
3 Boolean data type holds by default
A. True
C. False
E. Null
G. 1
CCP503.23 25
Frequently Asked Questions
1. List the different types of Numeric variables?
CCP503.23 26