SlideShare a Scribd company logo
2
Most read
3
Most read
5
Most read
Datatypes in VB.net:
 The data typesof a programmingelement refertowhatkindof data itcan holdandhow it
storesthat data.
 A data type, in programming, is a classification that specifies which type of value a variable
has and what type of mathematical, relational or logical operations can be applied to it without
causing an error. A string, for example, is a data type that is used to classify text and an
integer is a data type used to classify whole number
Types of data types in vb.net:
1: Booleandatatype.
2: integerdatatypes.
3: FloatingPointsnumber.
4: Stringand chars.
5: Date.
1) Boolean:
A Boolean stores a value indicating True or False. It can be used as an expression in
an If-statement. It can also store the result of an expression. Booleans are used
throughout VB.NET programs.
“Dim valuesasBoolean”
Value = true
Or
Value = False.
Dimloginas Boolean.
Password= ‘BSCS’
2) Integers:
Integer is a core type in VB.NET programs. It is the default numeric type. Usually
loops use the Integer type for their indexes. An Integer is declared with a Dim
statement. It can store positive values, such as 1, and negative values, such as -1.
In integerswe take whole number.
Example:we make a program where youwantthat users entertheirage so,whenthey enter
theirage you needtodefine variables.
Dimage As byte.
Login= true
Username SBK
Age=24
3) Floating Points Numbers:
If sometimesuserinputsfloatingpointnumberso, theyuse floatingpointnumbersdatatypes.
for example:we make aprogram where studentswant toentertheirpercentage
Dimpercentage assingle
Percentage=78.9
Decimal values cannotbe storedinintegerbecause inintegernumberswe canstore onlywhole
numberthatis withoutdecimal point.
4) Strings and Chars:
Stringisa data type representingtextual dataincomputerprogram.The Char type is
useful. Chars are value types. This means they are located in the bytes on the
evaluation stack. You can get individual Chars from a String variable.
Example:
Dimusername asstring
Username = “Fatima”
Dimcity as string
City= “Quetta”
Dimschool name as string
School name = “ SBK“
5) Date:
A date is value type whichcontainsdate values,time values,ordate andtime values.
Dimtoday as date
Today = now()
Data Types Available in VB.Net
VB.Net provides a wide range of data types. The following table shows all the data
types available:
Data
Type
Storage Allocation Value Range
Boolean Depends on implementing
platform
True or False
Integer 4 bytes -2,147,483,648 through 2,147,483,647
(signed)
Decimal 16 bytes 0 through +/-
79,228,162,514,264,337,593,543,950,335
(+/-7.9...E+28) with no decimal point; 0
through +/-
7.9228162514264337593543950335 with
28 places to the right of the decimal
Double 8 bytes
-1.79769313486231570E+308 through -
4.94065645841246544E-324, for
negative values
4.94065645841246544E-324 through
1.79769313486231570E+308, for
positive values
Single 4 bytes
-3.4028235E+38 through -1.401298E-45
for negative values;
1.401298E-45 through 3.4028235E+38
for positive values
String Depends on implementing
platform
0 to approximately 2 billion Unicode
characters
Char 2 bytes 0 through 65535 (unsigned)
Date 8 bytes 0:00:00 (midnight) on January 1, 0001
through 11:59:59 PM on December 31,
9999
Operators in VB.Net:
An operator is a symbol that tells the compiler to perform specific mathematical or
logical manipulations. VB.Net is rich in built-in operators and provides following types of
commonly used operators:
 Arithmetic Operators
 Comparison Operators
 Logical/Bitwise Operators
 Assignment Operators
 Concatenation
Arithmetic Operators
This table shows all the arithmetic operators. Assume variable A holds 2 and
variable B holds 7, then:
Comparison Operators
This table shows all the comparison operators. Assume variable A holds 10 and
variable B holds 20, then:
Operator Description Example
^ Raises one operand to the power of another B^A will
give 49
+ Adds two operands A + B
will give
9
- Subtracts second operand from the first A - B will
give -5
* Multiplies both operands A * B will
give 14
/ Divides one operand by another and returns a floating
point result
B / A will
give 3.5
 Divides one operand by another and returns an integer
result
B  A will
give 3
MOD Modulus Operator and remainder of after an integer
division
B MOD A
will give
1
Operator Description Example
= Checks if the values of two operands are equal or not; if
yes, then condition becomes true.
(A = B)
is not
true.
<> Checks if the values of two operands are equal or not; if
values are not equal, then condition becomes true.
(A <> B)
is true.
> Checks if the value of left operand is greater than the
value of right operand; if yes, then condition becomes
true.
(A > B)
is not
true.
< Checks if the value of left operand is less than the value of
right operand; if yes, then condition becomes true.
(A < B)
is true.
>= Checks if the value of left operand is greater than or equal
to the value of right operand; if yes, then condition
becomes true.
(A >= B)
is not
true.
<= Checks if the value of left operand is less than or equal to
the value of right operand; if yes, then condition becomes
true.
(A <= B)
is true.
Logical/Bitwise Operators
This table shows all the logical operators. Assume variable A holds Boolean value True
and variable B holds Boolean Value False, then:
Operator Description Example
And It is the logical as well as bitwise AND operator. If both the
operands are true, then condition becomes true. This
operator does not perform short-circuiting, i.e., it
evaluates both the expressions.
(A And
B) is
False.
Or It is the logical as well as bitwise OR operator. If any of
the two operands is true, then condition becomes true.
This operator does not perform short-circuiting, i.e., it
(A Or B)
is True.
evaluates both the expressions.
Not It is the logical as well as bitwise NOT operator. Use to
reverses the logical state of its operand. If a condition is
true, then Logical NOT operator will make false.
Not(A
And B) is
True.
Xor It is the logical as well as bitwise Logical Exclusive OR
operator. It returns True if both expressions are True or
both expressions are False; otherwise it returns False. This
operator does not perform short-circuiting, it always
evaluates both expressions and there is no short-circuiting
counterpart of this operator.
A Xor B
is True.
Name = Fatima
F/name = SadiqAli
Assignment=Visual programming
Submittedto= Ma’am Nausheen
Enroll = S14/BSCS/49
Semester=7th

More Related Content

PPTX
Function in c program
PPTX
Pointers,virtual functions and polymorphism cpp
PPTX
String Handling in c++
PPTX
Operators used in vb.net
PPTX
Functions in c language
PPTX
Variables in C++, data types in c++
PDF
Conditional Statements & Loops
PPTX
Variable scope ppt in vb6
Function in c program
Pointers,virtual functions and polymorphism cpp
String Handling in c++
Operators used in vb.net
Functions in c language
Variables in C++, data types in c++
Conditional Statements & Loops
Variable scope ppt in vb6

What's hot (20)

PPTX
C++ decision making
PPT
16717 functions in C++
 
PPTX
Static Data Members and Member Functions
PDF
PPTX
The string class
PPTX
Switch case in C++
PPTX
Branching statements
PPTX
VB Function and procedure
PPT
Operator overloading
PPTX
07. Virtual Functions
PPTX
C# Delegates
PPTX
Function in c
PDF
Character Array and String
PDF
Arrays in c unit iii chapter 1 mrs.sowmya jyothi
PPT
Array in c
PPTX
Polymorphism in C++
PDF
Unit ii chapter 2 Decision making and Branching in C
PPTX
Conditional statements
PPTX
Loops Basics
PPTX
Keywords, identifiers and data type of vb.net
C++ decision making
16717 functions in C++
 
Static Data Members and Member Functions
The string class
Switch case in C++
Branching statements
VB Function and procedure
Operator overloading
07. Virtual Functions
C# Delegates
Function in c
Character Array and String
Arrays in c unit iii chapter 1 mrs.sowmya jyothi
Array in c
Polymorphism in C++
Unit ii chapter 2 Decision making and Branching in C
Conditional statements
Loops Basics
Keywords, identifiers and data type of vb.net
Ad

Similar to Data types and operators in vb (20)

PPS
Programming in Arduino (Part 1)
PPTX
data type.pptxddddswwyertr hai na ki extend kr de la
PPT
Ap Power Point Chpt2
PPTX
Python programming language introduction unit
DOCX
C# language basics (Visual Studio)
DOCX
C# language basics (Visual studio)
PDF
vb.net.pdf
DOC
C programming operators
PPTX
Basic VB.Net & Ms. Acces Integration to creat database application by. Rizki...
PPTX
C++ revision add on till now
PPTX
C++ revision add on till now
PPTX
ChapterTwoandThreefnfgncvdjhgjshgjdlahgjlhglj.pptx
PPTX
Python_Module_3_AFkkkkV_Operators-1.pptx
PPTX
r language ...basic introduction Unit 1 R.pptx
PPTX
Operators and it's type
PDF
Types of Operators in C
PPTX
Programming presentation
PPTX
Vb script final pari
PDF
Operators in c programming
Programming in Arduino (Part 1)
data type.pptxddddswwyertr hai na ki extend kr de la
Ap Power Point Chpt2
Python programming language introduction unit
C# language basics (Visual Studio)
C# language basics (Visual studio)
vb.net.pdf
C programming operators
Basic VB.Net & Ms. Acces Integration to creat database application by. Rizki...
C++ revision add on till now
C++ revision add on till now
ChapterTwoandThreefnfgncvdjhgjshgjdlahgjlhglj.pptx
Python_Module_3_AFkkkkV_Operators-1.pptx
r language ...basic introduction Unit 1 R.pptx
Operators and it's type
Types of Operators in C
Programming presentation
Vb script final pari
Operators in c programming
Ad

More from alldesign (20)

DOCX
Vb lecture
DOCX
Vb lecture notes
PDF
Color model
PDF
Computer graphics circle
PDF
Getstart graphic
PDF
Image types,raster and vector graphics
PDF
Graphics c
PDF
Image types,raster and vector graphics
PPTX
Graphics display devices
PPT
Circles graphic
PPTX
Cg applications
PPTX
Types of cards
PPTX
External types of hardware
PPTX
Devices of computer
PPTX
Internal computer hardware
PPTX
Computer hardware
PPTX
Types of slots
PPTX
Application of computer graphic
PPTX
What is computer graphics
PPTX
Types of rom
Vb lecture
Vb lecture notes
Color model
Computer graphics circle
Getstart graphic
Image types,raster and vector graphics
Graphics c
Image types,raster and vector graphics
Graphics display devices
Circles graphic
Cg applications
Types of cards
External types of hardware
Devices of computer
Internal computer hardware
Computer hardware
Types of slots
Application of computer graphic
What is computer graphics
Types of rom

Recently uploaded (20)

PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PPTX
Cell Types and Its function , kingdom of life
PDF
Insiders guide to clinical Medicine.pdf
PPTX
Institutional Correction lecture only . . .
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Pre independence Education in Inndia.pdf
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Complications of Minimal Access Surgery at WLH
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PDF
Basic Mud Logging Guide for educational purpose
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Classroom Observation Tools for Teachers
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
human mycosis Human fungal infections are called human mycosis..pptx
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
Cell Types and Its function , kingdom of life
Insiders guide to clinical Medicine.pdf
Institutional Correction lecture only . . .
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
STATICS OF THE RIGID BODIES Hibbelers.pdf
Pre independence Education in Inndia.pdf
TR - Agricultural Crops Production NC III.pdf
Microbial disease of the cardiovascular and lymphatic systems
Complications of Minimal Access Surgery at WLH
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
Basic Mud Logging Guide for educational purpose
VCE English Exam - Section C Student Revision Booklet
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Classroom Observation Tools for Teachers
O7-L3 Supply Chain Operations - ICLT Program
2.FourierTransform-ShortQuestionswithAnswers.pdf
Supply Chain Operations Speaking Notes -ICLT Program
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...

Data types and operators in vb

  • 1. Datatypes in VB.net:  The data typesof a programmingelement refertowhatkindof data itcan holdandhow it storesthat data.  A data type, in programming, is a classification that specifies which type of value a variable has and what type of mathematical, relational or logical operations can be applied to it without causing an error. A string, for example, is a data type that is used to classify text and an integer is a data type used to classify whole number Types of data types in vb.net: 1: Booleandatatype. 2: integerdatatypes. 3: FloatingPointsnumber. 4: Stringand chars. 5: Date. 1) Boolean: A Boolean stores a value indicating True or False. It can be used as an expression in an If-statement. It can also store the result of an expression. Booleans are used throughout VB.NET programs. “Dim valuesasBoolean” Value = true Or Value = False. Dimloginas Boolean. Password= ‘BSCS’ 2) Integers: Integer is a core type in VB.NET programs. It is the default numeric type. Usually loops use the Integer type for their indexes. An Integer is declared with a Dim statement. It can store positive values, such as 1, and negative values, such as -1. In integerswe take whole number. Example:we make a program where youwantthat users entertheirage so,whenthey enter theirage you needtodefine variables. Dimage As byte. Login= true Username SBK
  • 2. Age=24 3) Floating Points Numbers: If sometimesuserinputsfloatingpointnumberso, theyuse floatingpointnumbersdatatypes. for example:we make aprogram where studentswant toentertheirpercentage Dimpercentage assingle Percentage=78.9 Decimal values cannotbe storedinintegerbecause inintegernumberswe canstore onlywhole numberthatis withoutdecimal point. 4) Strings and Chars: Stringisa data type representingtextual dataincomputerprogram.The Char type is useful. Chars are value types. This means they are located in the bytes on the evaluation stack. You can get individual Chars from a String variable. Example: Dimusername asstring Username = “Fatima” Dimcity as string City= “Quetta” Dimschool name as string School name = “ SBK“ 5) Date: A date is value type whichcontainsdate values,time values,ordate andtime values. Dimtoday as date Today = now() Data Types Available in VB.Net VB.Net provides a wide range of data types. The following table shows all the data types available: Data Type Storage Allocation Value Range Boolean Depends on implementing platform True or False
  • 3. Integer 4 bytes -2,147,483,648 through 2,147,483,647 (signed) Decimal 16 bytes 0 through +/- 79,228,162,514,264,337,593,543,950,335 (+/-7.9...E+28) with no decimal point; 0 through +/- 7.9228162514264337593543950335 with 28 places to the right of the decimal Double 8 bytes -1.79769313486231570E+308 through - 4.94065645841246544E-324, for negative values 4.94065645841246544E-324 through 1.79769313486231570E+308, for positive values Single 4 bytes -3.4028235E+38 through -1.401298E-45 for negative values; 1.401298E-45 through 3.4028235E+38 for positive values String Depends on implementing platform 0 to approximately 2 billion Unicode characters Char 2 bytes 0 through 65535 (unsigned) Date 8 bytes 0:00:00 (midnight) on January 1, 0001 through 11:59:59 PM on December 31, 9999 Operators in VB.Net: An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations. VB.Net is rich in built-in operators and provides following types of commonly used operators:  Arithmetic Operators  Comparison Operators
  • 4.  Logical/Bitwise Operators  Assignment Operators  Concatenation Arithmetic Operators This table shows all the arithmetic operators. Assume variable A holds 2 and variable B holds 7, then: Comparison Operators This table shows all the comparison operators. Assume variable A holds 10 and variable B holds 20, then: Operator Description Example ^ Raises one operand to the power of another B^A will give 49 + Adds two operands A + B will give 9 - Subtracts second operand from the first A - B will give -5 * Multiplies both operands A * B will give 14 / Divides one operand by another and returns a floating point result B / A will give 3.5 Divides one operand by another and returns an integer result B A will give 3 MOD Modulus Operator and remainder of after an integer division B MOD A will give 1
  • 5. Operator Description Example = Checks if the values of two operands are equal or not; if yes, then condition becomes true. (A = B) is not true. <> Checks if the values of two operands are equal or not; if values are not equal, then condition becomes true. (A <> B) is true. > Checks if the value of left operand is greater than the value of right operand; if yes, then condition becomes true. (A > B) is not true. < Checks if the value of left operand is less than the value of right operand; if yes, then condition becomes true. (A < B) is true. >= Checks if the value of left operand is greater than or equal to the value of right operand; if yes, then condition becomes true. (A >= B) is not true. <= Checks if the value of left operand is less than or equal to the value of right operand; if yes, then condition becomes true. (A <= B) is true. Logical/Bitwise Operators This table shows all the logical operators. Assume variable A holds Boolean value True and variable B holds Boolean Value False, then: Operator Description Example And It is the logical as well as bitwise AND operator. If both the operands are true, then condition becomes true. This operator does not perform short-circuiting, i.e., it evaluates both the expressions. (A And B) is False. Or It is the logical as well as bitwise OR operator. If any of the two operands is true, then condition becomes true. This operator does not perform short-circuiting, i.e., it (A Or B) is True.
  • 6. evaluates both the expressions. Not It is the logical as well as bitwise NOT operator. Use to reverses the logical state of its operand. If a condition is true, then Logical NOT operator will make false. Not(A And B) is True. Xor It is the logical as well as bitwise Logical Exclusive OR operator. It returns True if both expressions are True or both expressions are False; otherwise it returns False. This operator does not perform short-circuiting, it always evaluates both expressions and there is no short-circuiting counterpart of this operator. A Xor B is True. Name = Fatima F/name = SadiqAli Assignment=Visual programming Submittedto= Ma’am Nausheen Enroll = S14/BSCS/49 Semester=7th