SlideShare a Scribd company logo
VISUAL BASIC 6.0
Function And Procedures

                          By Pragya Ratan Sagar
Functions
It is a separate procedure that can take arguments, perform a series of
statements and change the value of its argument
                             or
Functions are named blocks program code that perform a specific task
and return a result. The task can be as simple as adding two numbers
or as complex as launching a spacecraft

Syntax:
   Function FunctionName(argument list) As Datatype
        VB statements. . . .
   End Function

                                                                          1
The arguments to the function are declared as :
    1. By ref
        When passing by reference, the address of arguments are passed.
Example:
Public Function Sum(ByRef Number1 As Double, ByRef Number2 As
Double) As Double
         Sum = Number1 + Number2
End Function

2. By val
       When passing by value, copies of the arguments are passed.
Example:



                                                                          2
Procedures
Procedure is a block of statements which performs a particular task,
just that it does not return a result
Syntax:
[Private|Public] Sub ProcedureName(argument list)
  VB Statements. . . .
End Sub

Types of procedures:
1. General Procedure
   General procedure is one that we create for our own specific
   purpose.
2. Event Procedure
   Event procedure is a procedure associated with the event of an
                                                                        3
   object and are named in a way that indicates both event and object
   clearly.
Calling a Procedure
Procedure are called with or without the keyword call
Syntax:
….
Call procedurename()
….

Example:
Private Sub clearcontrols()
Text1.text = “ “
                                 General Procedure
Text2.text = “ “
End Sub

Private Sub cmdreset_click()
Call clearcontrols()             Event Procedure
End Sub                                                 4
Function And Procedures




                          By Pragya Ratan Sagar

More Related Content

What's hot

Looping statements in Java
Looping statements in JavaLooping statements in Java
Looping statements in Java
Jin Castor
 

What's hot (20)

Sdi & mdi
Sdi & mdiSdi & mdi
Sdi & mdi
 
Vb 6.0 controls
Vb 6.0 controlsVb 6.0 controls
Vb 6.0 controls
 
Odbc and data access objects
Odbc and data access objectsOdbc and data access objects
Odbc and data access objects
 
Event handling
Event handlingEvent handling
Event handling
 
Variable scope ppt in vb6
Variable scope ppt in vb6Variable scope ppt in vb6
Variable scope ppt in vb6
 
ASP.NET - Life cycle of asp
ASP.NET - Life cycle of aspASP.NET - Life cycle of asp
ASP.NET - Life cycle of asp
 
Command line arguments
Command line argumentsCommand line arguments
Command line arguments
 
Design notation
Design notationDesign notation
Design notation
 
Vb.net (loop structure)
Vb.net (loop structure)Vb.net (loop structure)
Vb.net (loop structure)
 
VB.NET:An introduction to Namespaces in .NET framework
VB.NET:An introduction to  Namespaces in .NET frameworkVB.NET:An introduction to  Namespaces in .NET framework
VB.NET:An introduction to Namespaces in .NET framework
 
Operators in java
Operators in javaOperators in java
Operators in java
 
Java Tokens
Java  TokensJava  Tokens
Java Tokens
 
Visual Basic Controls ppt
Visual Basic Controls pptVisual Basic Controls ppt
Visual Basic Controls ppt
 
Lecture 1 introduction to vb.net
Lecture 1   introduction to vb.netLecture 1   introduction to vb.net
Lecture 1 introduction to vb.net
 
Break and continue
Break and continueBreak and continue
Break and continue
 
parameter passing in c#
parameter passing in c#parameter passing in c#
parameter passing in c#
 
Java-java virtual machine
Java-java virtual machineJava-java virtual machine
Java-java virtual machine
 
Visual Basic menu
Visual Basic menuVisual Basic menu
Visual Basic menu
 
Data types vbnet
Data types vbnetData types vbnet
Data types vbnet
 
Looping statements in Java
Looping statements in JavaLooping statements in Java
Looping statements in Java
 

Viewers also liked

Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)
pbarasia
 
Introduction to visual basic programming
Introduction to visual basic programmingIntroduction to visual basic programming
Introduction to visual basic programming
Roger Argarin
 
Visual basic ppt for tutorials computer
Visual basic ppt for tutorials computerVisual basic ppt for tutorials computer
Visual basic ppt for tutorials computer
simran153
 
Basic controls of Visual Basic 6.0
Basic controls of Visual Basic 6.0Basic controls of Visual Basic 6.0
Basic controls of Visual Basic 6.0
Salim M
 
Functions of visual_language
Functions of visual_languageFunctions of visual_language
Functions of visual_language
akeka
 
Menu pop up menu mdi form and playing audio in vb
Menu pop up menu mdi form and playing audio in vbMenu pop up menu mdi form and playing audio in vb
Menu pop up menu mdi form and playing audio in vb
Amandeep Kaur
 
Lesson9 Working With Basic Functions
Lesson9 Working With Basic FunctionsLesson9 Working With Basic Functions
Lesson9 Working With Basic Functions
guevarra_2000
 
Date & time functions in VB.NET
Date & time functions in VB.NETDate & time functions in VB.NET
Date & time functions in VB.NET
A R
 

Viewers also liked (20)

Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)
 
Vb decision making statements
Vb decision making statementsVb decision making statements
Vb decision making statements
 
Visual basic 6
Visual basic 6Visual basic 6
Visual basic 6
 
visual basic for the beginner
visual basic for the beginnervisual basic for the beginner
visual basic for the beginner
 
Visual Basic 6.0
Visual Basic 6.0Visual Basic 6.0
Visual Basic 6.0
 
Introduction to visual basic programming
Introduction to visual basic programmingIntroduction to visual basic programming
Introduction to visual basic programming
 
Visual basic ppt for tutorials computer
Visual basic ppt for tutorials computerVisual basic ppt for tutorials computer
Visual basic ppt for tutorials computer
 
INPUT BOX- VBA
INPUT BOX- VBAINPUT BOX- VBA
INPUT BOX- VBA
 
Objects and classes in Visual Basic
Objects and classes in Visual BasicObjects and classes in Visual Basic
Objects and classes in Visual Basic
 
Visual basic 6
Visual basic 6Visual basic 6
Visual basic 6
 
Basic controls of Visual Basic 6.0
Basic controls of Visual Basic 6.0Basic controls of Visual Basic 6.0
Basic controls of Visual Basic 6.0
 
Control statements
Control statementsControl statements
Control statements
 
Functions of visual_language
Functions of visual_languageFunctions of visual_language
Functions of visual_language
 
InputBox
InputBoxInputBox
InputBox
 
Notas InputBox
Notas InputBoxNotas InputBox
Notas InputBox
 
Menu pop up menu mdi form and playing audio in vb
Menu pop up menu mdi form and playing audio in vbMenu pop up menu mdi form and playing audio in vb
Menu pop up menu mdi form and playing audio in vb
 
Lesson9 Working With Basic Functions
Lesson9 Working With Basic FunctionsLesson9 Working With Basic Functions
Lesson9 Working With Basic Functions
 
Vb
VbVb
Vb
 
Date & time functions in VB.NET
Date & time functions in VB.NETDate & time functions in VB.NET
Date & time functions in VB.NET
 
Ms visual-basic-6
Ms visual-basic-6Ms visual-basic-6
Ms visual-basic-6
 

Similar to VB Function and procedure

Object oriented concepts & programming (2620003)
Object oriented concepts & programming (2620003)Object oriented concepts & programming (2620003)
Object oriented concepts & programming (2620003)
nirajmandaliya
 
Chapter_1.__Functions_in_C++[1].pdf
Chapter_1.__Functions_in_C++[1].pdfChapter_1.__Functions_in_C++[1].pdf
Chapter_1.__Functions_in_C++[1].pdf
TeshaleSiyum
 
Chapter 1. Functions in C++.pdf
Chapter 1.  Functions in C++.pdfChapter 1.  Functions in C++.pdf
Chapter 1. Functions in C++.pdf
TeshaleSiyum
 
Booa8 Slide 09
Booa8 Slide 09Booa8 Slide 09
Booa8 Slide 09
oswchavez
 
Java session01
Java session01Java session01
Java session01
Niit Care
 

Similar to VB Function and procedure (20)

Presentation of computer
Presentation of computerPresentation of computer
Presentation of computer
 
Function & procedure
Function & procedureFunction & procedure
Function & procedure
 
functions.pptx
functions.pptxfunctions.pptx
functions.pptx
 
Functions part1
Functions part1Functions part1
Functions part1
 
Fnctions part2
Fnctions part2Fnctions part2
Fnctions part2
 
Object oriented concepts & programming (2620003)
Object oriented concepts & programming (2620003)Object oriented concepts & programming (2620003)
Object oriented concepts & programming (2620003)
 
User defined functions in matlab
User defined functions in  matlabUser defined functions in  matlab
User defined functions in matlab
 
Unit iii vb_study_materials
Unit iii vb_study_materialsUnit iii vb_study_materials
Unit iii vb_study_materials
 
Chapter_1.__Functions_in_C++[1].pdf
Chapter_1.__Functions_in_C++[1].pdfChapter_1.__Functions_in_C++[1].pdf
Chapter_1.__Functions_in_C++[1].pdf
 
Chapter 1. Functions in C++.pdf
Chapter 1.  Functions in C++.pdfChapter 1.  Functions in C++.pdf
Chapter 1. Functions in C++.pdf
 
Booa8 Slide 09
Booa8 Slide 09Booa8 Slide 09
Booa8 Slide 09
 
C++ Object oriented concepts & programming
C++ Object oriented concepts & programmingC++ Object oriented concepts & programming
C++ Object oriented concepts & programming
 
Section-6-User-Defined-Functions.pdf
Section-6-User-Defined-Functions.pdfSection-6-User-Defined-Functions.pdf
Section-6-User-Defined-Functions.pdf
 
The Ring programming language version 1.8 book - Part 26 of 202
The Ring programming language version 1.8 book - Part 26 of 202The Ring programming language version 1.8 book - Part 26 of 202
The Ring programming language version 1.8 book - Part 26 of 202
 
VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1
 
procedures and arrays
procedures and arraysprocedures and arrays
procedures and arrays
 
Java session01
Java session01Java session01
Java session01
 
The Ring programming language version 1.9 book - Part 28 of 210
The Ring programming language version 1.9 book - Part 28 of 210The Ring programming language version 1.9 book - Part 28 of 210
The Ring programming language version 1.9 book - Part 28 of 210
 
Functions
FunctionsFunctions
Functions
 
Diifeerences In C#
Diifeerences In C#Diifeerences In C#
Diifeerences In C#
 

Recently uploaded

Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 

Recently uploaded (20)

Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Mattingly "AI & Prompt Design: Limitations and Solutions with LLMs"
Mattingly "AI & Prompt Design: Limitations and Solutions with LLMs"Mattingly "AI & Prompt Design: Limitations and Solutions with LLMs"
Mattingly "AI & Prompt Design: Limitations and Solutions with LLMs"
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
Salient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptxSalient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptx
 
Gyanartha SciBizTech Quiz slideshare.pptx
Gyanartha SciBizTech Quiz slideshare.pptxGyanartha SciBizTech Quiz slideshare.pptx
Gyanartha SciBizTech Quiz slideshare.pptx
 
[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online Presentation[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online Presentation
 
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxslides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & EngineeringBasic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
NCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdfNCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdf
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
Forest and Wildlife Resources Class 10 Free Study Material PDF
Forest and Wildlife Resources Class 10 Free Study Material PDFForest and Wildlife Resources Class 10 Free Study Material PDF
Forest and Wildlife Resources Class 10 Free Study Material PDF
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
 
Application of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesApplication of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matrices
 
B.ed spl. HI pdusu exam paper-2023-24.pdf
B.ed spl. HI pdusu exam paper-2023-24.pdfB.ed spl. HI pdusu exam paper-2023-24.pdf
B.ed spl. HI pdusu exam paper-2023-24.pdf
 

VB Function and procedure

  • 1. VISUAL BASIC 6.0 Function And Procedures By Pragya Ratan Sagar
  • 2. Functions It is a separate procedure that can take arguments, perform a series of statements and change the value of its argument or Functions are named blocks program code that perform a specific task and return a result. The task can be as simple as adding two numbers or as complex as launching a spacecraft Syntax: Function FunctionName(argument list) As Datatype VB statements. . . . End Function 1
  • 3. The arguments to the function are declared as : 1. By ref When passing by reference, the address of arguments are passed. Example: Public Function Sum(ByRef Number1 As Double, ByRef Number2 As Double) As Double Sum = Number1 + Number2 End Function 2. By val When passing by value, copies of the arguments are passed. Example: 2
  • 4. Procedures Procedure is a block of statements which performs a particular task, just that it does not return a result Syntax: [Private|Public] Sub ProcedureName(argument list) VB Statements. . . . End Sub Types of procedures: 1. General Procedure General procedure is one that we create for our own specific purpose. 2. Event Procedure Event procedure is a procedure associated with the event of an 3 object and are named in a way that indicates both event and object clearly.
  • 5. Calling a Procedure Procedure are called with or without the keyword call Syntax: …. Call procedurename() …. Example: Private Sub clearcontrols() Text1.text = “ “ General Procedure Text2.text = “ “ End Sub Private Sub cmdreset_click() Call clearcontrols() Event Procedure End Sub 4
  • 6. Function And Procedures By Pragya Ratan Sagar