# DROP OBJECT Delete Object

> Source: https://manual.pvxplus.com/directives/drop-object

## Format

**DROP OBJECT** *obj_id*\[,**ERR**=*stmtref*\]

***Where:***

|  |  |
| --- | --- |
| *obj_id* | Object identifier. |
| *stmtref* | Program line number or statement label to which to transfer control. |

Note:  
The [DELETE OBJECT](https://manual.pvxplus.com/directives/delete-object) directive works the same as DROP OBJECT.

## Description

The **DROP OBJECT** directive is used to delete an object.

**DROP OBJECT**, **DELETE OBJECT** and the **[REF( )](https://manual.pvxplus.com/functions/ref)** function can all be used to delete an object. Only objects whose reference count is 1 can be deleted. Once an object is destroyed, its identifier may be reassigned to another object, although this is not recommended. All objects are destroyed when the application issues a **START** directive or if the **END** directive is entered at the Command mode.

**REF(READ** *obj_id*) returns the current reference count value. All calls to **REF( )** return the current reference count (or 0 if deleted).

## See Also

**[Object Oriented Programming](https://manual.pvxplus.com/pxplus-user-guide/object-oriented-pxplus/introduction)**  
[DEF OBJECT Define Windows Object](https://manual.pvxplus.com/directives/def-object)  
[Apostrophe Operator](https://manual.pvxplus.com/appendix/apostrophe-operator)  
**[Automation in PxPlus](https://manual.pvxplus.com/automation-in-pxplus/introduction)**
