Page 188 - Open Soource Technologies 304.indd
P. 188

Event Driven Programming                   Kumar Vishal, Lovely Professional University





                                  Unit 8: Understanding Function and Procedure





                            CONTENTS

                            Objectives
                            Introduction
                            8.1 Meaning of Understanding Function and Procedure
                            8.2 Function Procedure
                            8.3 User-Defined Function Having Several Parameters

                            8.4 User-Defined Function Having No Parameters
                            8.5 Comparing Function Procedures with Sub Procedures
                            8.6 Collapsing a Procedures with a Region Directive
                            8.7 Modules
                            8.8 Summary
                            8.9 Keywords
                            8.10 Self Assessment Questions
                            8.11 Review Questions
                            8.12 Further Readings


                          Objectives

                          After studying this unit, you will be able to:
                            • Understanding function and procedure definition
                            • Discuss user defined functions with several parameters
                            • Explain the function procedures and its features.

                          Introduction

                          In your code you may frequently need to use the same instructions, by declaring a function/
                          procedure and typing the needed instructions into it you can replace the repeated instructions
                          with a call to this function. Functions/Procedures are a very useful part of Visual Basic program-
                          ming because your code will be smaller more stable, faster and easy to debug.
                          The difference between them is that functions must return a value and procedures do not.
                          Visual Basic offers different types of procedures to execute small sections of coding in
                          applications. Visual Basic programs can be broken into smaller logical components called
                          Procedures. Procedures are useful for condensing repeated operations such as the frequently
                          used calculations, text and control manipulation, etc. The benefits of using procedures in
                          programming are:


                          182                    LOVELY PROFESSIONAL UNIVERSITY
   183   184   185   186   187   188   189   190   191   192   193