Now you create two user-defined exception objects that you will throw from a function that is invoked when the user clicks the command button on the w_cust_pct window. You also create a user-defined exception object that you throw from a user event on the drop-down list box control that you added to the w_cust_pct window.
Select File>New from the PowerBuilder menu and click the PBObject tab in the New dialog box.
Select the Standard Class icon and click OK.
Select throwable
from
the Types list box and click OK.
The new exception object displays in the User Object painter.
In the Text box of the Properties view, type the following:
No rows were returned from the database. If you typed or selected a state code in the drop-down list box and the database connection has not been closed, either the state you entered has no customers or you entered the state code incorrectly.
The exception object has get and set methods for handling the Text property. Here you set the text property directly in the user interface.
Click outside the Properties view to enable the Save button.
Select File>Save, select the pbtutor.pbl application
library, and type exc_no_rows
in
the User Objects box for the new exception object name, and click
OK.
Select File>Close.
Repeat steps 1-5 using the following values for the Text property and the exception object name:
Property |
Value |
---|---|
Text |
|
Exception object name |
exc_low_number |
Repeat steps 1-5 using the following values for the Text property and the exception object name:
Property |
Value |
---|---|
Text |
|
Exception object name |
exc_bad_entry |