CCP503
CCP503
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 Minutes
Topic : Programming Fundamentals
Sub. Topic : Parameter Passing to Procedures in VB
Programming.
Teaching Aids : PPT, Animation
CCP503.40
Clips and Images 1
Objectives
On completion of this period, you would be
able to know
CCP503.40 2
Recap
Recursion concept
Examples of Recursion
CCP503.40 3
Arguments (Parameters)
Definition: An Argument is a value to be passed
to the Procedure / Function and on which the
procedure / Function usually acts.
CCP503.40 4
Types of Arguments
CCP503.40 5
Passing Arguments/ Parameters Technique
CCP503.40 6
Passing Arguments by Reference
CCP503.40 7
Example:
CCP503.40 8
Private Sub CmdAdd_ Click ()
Dim X as Integer,
Dim Y As Integer,
Dim Sum As Integer
X=10
Y=2
Sum=Add(X, Y)
Text1.text= X
Text2.text= Y
Text3.Text=sum
End Sub
CCP503.40 9
This code will display the following results in the
Textboxes Text1, Text2, .. respectively
Output: 0
0
12
The changes made to the function’s arguments take
effect even after the function has ended. The values
of the variables X and Y have changed permanently.
CCP503.40 10
Program at Design Time
CCP503.40 11
Program at Run time
CCP503.40 12
PROGRAM CODE
CCP503.40 13
Passing Arguments by Value
CCP503.40 15
Now call the function as follows.
CCP503.40 16
Remove the Keyword ByValue from the function’s
definition and call the function later then,
This time the program displays the following
message.
“ 0 Degrees Celsius are 89.6 Degrees Fahrenheit”
CCP503.40 17
SUMMARY
CCP503.40 18
FREQUENTLY ASKED QUESTIONS
CCP503.40 19
QUIZ
1. What is formal parameter?
A. Parameter in the Function’s header
B. Parameter in the Function’s reference
C. Parameter declared globally
D. Parameter declared locally
CCP503.40 21