Add a new
sheet window to the existing application
Where you are
> Add a new sheet
window to the existing application
Create user-defined
exception objects
Create a new user
function and user event
Call the methods and
catch the exceptions
In this lesson you add a third sheet window to the main tutorial
application. You create and call a function to perform a routine operation
(calculate a percentage) on values returned from embedded SQL commands and
a value selected by the application user from a drop-down list box
control.
The prototype for the function you create throws user-defined
exceptions. You call the function in a TRY-CATCH block inside the Clicked
event on a command button control. The CATCH clauses in the Clicked event
catch user-defined exceptions thrown by the new function as well as a
system exception thrown up the application call stack.
You use the new sheet window to calculate the percentage of
customers that resides in a selected state. The controls you add to the
new sheet window are:
-
Two static text boxes that you change programmatically to
display read-only results -
A command button to call a function that calculates
percentages -
A drop-down list box for a list of states where customers
reside -
A text box that displays the percentage of customers residing in
the state that application users select from the drop-down list
box
To add a sheet window to the existing application, you must: