Sunteți pe pagina 1din 18

DEPARTMENT OF TECHNICALEDUCATION

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 : Basics of VB Programming
Fundamentals.
Teaching Aids : PPT, Animation Clips & Images

CCP503.25 1
Objectives

On Completion of this period you would be


able to learn

 The different types of operators in VB

 How to make use of them in VB Program

CCP503.25 2
Structure

 Types of operators

 Examples

CCP503.25 3
RECAP
In the previous session you have learnt about ….

 The scope and life time of variables in the VB


Programming

 The module structure in a VB Program

 The nature of the Static variable and user defined


Variables in VB Program.

CCP503.25 4
Visual Basic Structure
 Forms: containing interface objects
 Form Objects: contain VB Code in event driven
subroutines (Sub)
 General: area for each Form to hold declarations for the
Form and definitions of Procedures:
 Sub Procedures
 Function Procedures
 Modules: contains Global Visual Basic Code in the form
of Procedures
 Class Modules (Objects): provide a Object Oriented
programming environment

CCP503.25 5
VB Programming Constructs

 Data stored in variables that must be declared


 Executable Statements, Assignment
statement (=) etc.,
 Operators:
 simple arithmetic (+, -, *, /...)
 string (text) manipulation
 date manipulation
 Event Handlers

CCP503.25 6
Operators in VB

 Definition : Operators are given that name because


they operate on the operands (i.e variables)
associated with them

CCP503.25 7
Types of Operators & Their Descriptions

Types of operators: There are several types of operators


in VB
2) Arithmetic Operators: Used to perform arithmetical
operations on one or more operands.
3) Comparison Operators: Used to perform Comparison
between Two Data Values
4) Logical Operators: Used to perform Logical
Operations
5) String Concatenation Operator : Used to perform
Combining two strings given.

CCP503.25 8
Arithmetical Operators
In order to perform arithmetical operations such as
 Addition

 Subtraction,

 Multiplication

 Division for Quotient

 Remainder after Division

CCP503.25 9
ARITHMETIC OPERATORS

 Addition : + Ex. C=A+B


 Subtraction : - Ex. C=A-B
 Multiplication : * Ex. C= A* B
 Division for Quotient : / or \ Ex. Q=A/B
 Division for Remainder : mod Ex. R= A mod /B

CCP503.25 10
COMPARISON OPERATORS

 These operators are also called as Relational


operators.
 The operators which are used to compare one or more
variables (Data values).

The list of operators are in VB


•Equality : = Ex. A = 35
•Inequality : <> Ex. If a <> b
•Greater than : > Ex. If a > b
•Less than : < Ex. If a < b
CCP503.25 11
LOGICAL OPERATORS

 The operators AND, OR, NOT comes under


this category

1) Negation : Not Ex. If a = Not 1> 2


2) Conjunction : And Ex. Res = Exp1 And Exp2
3) Disjunction : Or Ex. Res = Exp1 Or Exp2

CCP503.25 12
STRING CONCATENATION OPERATOR

 This operator is used to merge two strings.

 The operator : &

 Ex. FN = “APJ ABDUL” , LN=“ KALAM”

 NAME = FN & LN

 Out put would be : “ APJ ABDULKALAM”

CCP503.25 13
Summary

 Different types of Operators in Visual Basic like


Arithmetical Operators,
 Comparison Operators,

 Logical Operators and

 String Concatenation Operators

CCP503.25 14
Quiz

1) What is the symbol of Equality Operator?

A. =

B. = =

C. !=

D. <>

CCP503.25 15
2. What is a Form in VB ?

A. object
B. Interface
C. Module
D. class

CCP503.25 16
3. Which of the following is a logical
Operator?

A. +
B. <>
C. AND
D. &

CCP503.25 17
Frequently asked sample Questions

1. What is an operator and Operands?

2. List the different types of Operators in VB?

3. How to use an assignment operator in VB?

CCP503.25 18

S-ar putea să vă placă și