Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
ANDHRAPRADESH
Name : K. Sreeramacharyulu
Designation : Lecturer
Branch : Commercial and Computer Practice
Institute : Govt. Polytechnic, Srikakulam
Year/Semester : V Semester
Subject : VISUAL BASIC - I
Sub. Code : CCP-503
Topic : Programming Fundamentals
Duration : 50 Minutes
Sub. Topic : Functions concepts in VB
Teaching Aids : PPT, Clips and Images
CCP503.37 1
Objectives
CCP503.37 2
RECAP
The concepts of Sub-Programming in VB
CCP503.37 3
FUNCTIONS IN VB
Is a block of code similar to a subroutine, but returns a
value / result to calling code
There are some Built-in functions like Sin() & Cos(),
RGB() & QBCOLOR() we already learnt
Syntax:
Private / Public Function name (arguments) As Type
Sample Example for a function:
Function NextDay() As Date
NextDay = Date() + 1
End Function
CCP503.37 4
TYPES OF FUNCTIONS
CCP503.37 5
User defined Non-Recursive Functions
CCP503.37 6
Definition part includes
Name of the function,
return data type,
parameter to be passed if necessary,
return statement etc,.
CCP503.37 7
General Syntax of the User defined Function
CCP503.37 8
A function returns a single value through its
name
CCP503.37 9
Sample Example on User defined function
CCP503.37 10
Steps to create a sample Function
1. Open a new project
2. Design the program as per requirements
3. Go to code window, click on Tools menu, choose add
Procedure, then VB will display the following dialogue
box
4. Choose the Function option and then type Name of the
Function, click OK button
5. Then write the code whatever you want .
6. Use the function with function name
CCP503.37 11
CCP503.37 12
Program 1 on Non-Recursive User defined
Functions
Program to calculate future value of a certain amount ,
based on interest rate &number of years
CCP503.37 17
FREQUENTLY ASKED QUESTIONS
CCP503.37 18
QUIZ
A. True
B. False
C. 1
D. 2
E. 3
F. 4
CCP503.37 20
ASSIGNMENT
CCP503.37 21