Occurs when the DataWindow control or DataStore object is destroyed, immediately after the Close event of a window or form.

PowerBuilder event information

Event ID: pbm_destructor

Return Values

There are no special outcomes for this event. The only code is:

0 -- Continue processing


The Destructor event destroys the DataWindow control or DataStore object and removes it from memory. After it has been destroyed, you can no longer refer to it in other event code. (If you do, a runtime error occurs.)

Restriction on methods

Calling a DataStore method that accesses the underlying DataStore internals within this event is not a valid coding practice and can fail silently. Such methods include RowCount, DBCancel, and Modify.

When you issue a DESTROY on a DataStore, the Destructor event is triggered and a Windows WM_DESTROY message is added to the object's message queue. WM_DESTROY invalidates the memory for the DataStore. If the WM_DESTROY message is handled before the method calls in the Destructor event, methods that attempt to access the destroyed memory fail silently.

See also