# DELETE OBJECT Remove Object

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

## Format

**DELETE OBJECT** *ext_id*\[,**ERR**=*stmtref*\]

***Where:***

|  |  |
| --- | --- |
| *ext_id* | Numeric variable to receive a handle (memory pointer to the external object). |
| *stmtref* | Program line number or statement label to which to transfer control. |

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

## Description

The **DELETE OBJECT** directive is used to remove/disconnect associated external objects.

**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).

Note:  
An external object is automatically destroyed when the window it was defined in is dropped.

## See Also

For information on the creation of an external object, see **[DEF OBJECT](https://manual.pvxplus.com/directives/def-object)** directive.

## Example

```
def object handle,@(2,2,70,16)="*BROWSER"
errcode=handle'Navigate2("www.pvxplus.com")
input *
delete object handle
```
