ch08 - Microsoft Visual Basic 2008: Reloaded Third Edition...

Info iconThis preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter Eight Sub and Function Procedures
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Microsoft Visual Basic 2008: Reloaded, Third Edition 2 Objectives After studying this chapter, you should be able to: Explain the difference between a Sub procedure and a Function procedure Create a Sub procedure and a Function procedure Create a procedure that receives information passed to it Explain the difference between passing data by value and passing data by reference
Background image of page 2
Microsoft Visual Basic 2008: Reloaded, Third Edition 3 Objectives (continued) Explain the purpose of the sender and e parameters Associate a procedure with more than one object and event Utilize a timer control Convert an Object variable to a different type using the TryCast keyword
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Microsoft Visual Basic 2008: Reloaded, Third Edition 4 Procedures Procedure : a block of program code that performs a specific task Two types of procedures: Function procedure : returns a value after performing its task Sub procedure : does not return a value
Background image of page 4
Microsoft Visual Basic 2008: Reloaded, Third Edition 5 Sub Procedures Two types of Sub procedures: event and independent Sub procedures Event procedure : Sub procedure that is associated with a specific object and event Automatically processed when the associated event occurs Independent Sub procedure : Collection of code that can be invoked from one or more places in an application Not associated with an event Processed only when called (invoked)
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Microsoft Visual Basic 2008: Reloaded, Third Edition 6 Sub Procedures (continued) Independent Sub procedures are used to: Eliminate the duplication of code in different parts of a program Allow a large, complex application to be broken into small and manageable tasks Allow multiple programmers to work on an application simultaneously
Background image of page 6
Microsoft Visual Basic 2008: Reloaded, Third Edition 7 Figure 8-1: How to create an independent Sub procedure
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Microsoft Visual Basic 2008: Reloaded, Third Edition 8 Sub Procedures (continued) Independent Sub procedures: Have a procedure header and procedure footer Use Pascal case for names Optionally contain a parameter list Parameters : Declared in the procedure header Store the information passed into the procedure when it is invoked Call statement : invokes an independent Sub procedure
Background image of page 8
Microsoft Visual Basic 2008: Reloaded, Third Edition 9 Sub Procedures (continued) Figure 8-2: How to call an independent Sub procedure
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Microsoft Visual Basic 2008: Reloaded, Third Edition 10 The Gadis Antiques Application Figure 8-3: Sample run of the Gadis Antiques application
Background image of page 10
Microsoft Visual Basic 2008: Reloaded, Third Edition 11 Figure 8-4: Partial code for the Gadis Antiques application
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 12
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 36

ch08 - Microsoft Visual Basic 2008: Reloaded Third Edition...

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online