Chapter07 Slides

Chapter07 Slides - Chapter 7 Procedures and Functions MIS...

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

View Full Document Right Arrow Icon
Click to edit Master subtitle style Opportunity Chapter 7: Procedures and Functions MIS 304: Introduction to Problem Solving and Programming
Background image of page 1

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

View Full DocumentRight Arrow Icon
You will learn how to… Determine when and how to use procedures Create a flowchart for a procedure Determine when and how to use functions Use a sub or function written by another developer Create and code menus
Background image of page 2
Procedures (Subs) and Functions Subs and function are blocks of code that separate complicated code into simpler tasks or perform a specific task in more than one place Functions supply answers for complex or often-used problems
Background image of page 3

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

View Full DocumentRight Arrow Icon
Differences Between Subs and Functions 1. Return Value Functions return 1 and only 1 value Subs do NOT return a value 2. Declared Differently Functions must be declared with a data type Subs do NOT need a data type 3. Called Differently Functions called with a = Subs called using Call keyword
Background image of page 4
Why Use Procedures? Procedures break a program into smaller parts or take often-used code and store it in one place so it can be used in many places Procedures turn a complicated process into a series of simpler steps Modularization - separating a program into smaller, related components
Background image of page 5

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

View Full DocumentRight Arrow Icon
Avoid Redundancy Use procedures to avoid redundant code Write the code once in a procedure and use it in several places Makes for smaller programs Makes changes and
Background image of page 6
Sub Syntax All event handlers are Subs Developers can write and call their own procedures as well Private/Public Sub ProcedureName( arguments ) statement(s) End Sub
Background image of page 7

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

View Full DocumentRight Arrow Icon
Sample Sub Use this in the Load event and the Clear Button to display the headings Private Sub PrintHeading() rtbOut.Clear() Dim strMessage as String strMessage = “Shirt Type”.PadLeft(12) rtbOut.AppendText(strMessage) End Sub
Background image of page 8
Passing Arguments Argument - values used to complete
Background image of page 9

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

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

This note was uploaded on 11/29/2010 for the course MIS 304 taught by Professor Mote during the Fall '08 term at University of Texas.

Page1 / 36

Chapter07 Slides - Chapter 7 Procedures and Functions MIS...

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

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