Lab 7
comp 125-609, Goldwasser
Tuesday, October 12, 1999
Purpose: Using general procedures and functions
Please start by saving the following two files to disk (either a
floppy or D:\userdata)
You will be modifying this program by adding some new procedures.
NOTE: Do NOT modify the code in the Click routines and do not
access the textbox or picturebox controls in any of the code which you
write.
To get some practice using procedures and functions, we are going to
learn to write what is called a "wrapper function".
While writting programs, you will often run across a situation in
which you want a function which is almost identical to one which
already exists, but with a few minor changes. Possibly you want the
parameter list to be different, or possibly you want the behavior to
be modified slightly.
Rather than re-writing a new function completely from scratch, you can
often get away pretending to write a new function, but having your
function call the already existing function when you need it. By
doing it this way however, you have the opportunity to add a few of
your own lines of code before or after the existing function gets
called.
Let's see this in action.
Visual Basic has a built in function called InputBox which
brings a pop-up window onto the screen asking the user to enter some
text (see page 100). To call this function, you might use the syntax
answer = InputBox(prompt,title) where prompt and
title are String variables or constants. This
function returns as its result, the string which the user entered
Your goal for this lab is to successfully acomplish three tasks,
modifying the project which you have downloaded:
This lab is due before leaving class today. When you have completed
the program you should do the following: