LPARAMETERS tcFormName
LOCAL lnElem, ;
lnRow
*-- Scan this.aInstances[] looking for tcFormName. If found
*-- decrement the instance count for that name by 1. If this
*-- is the last instance, remove the row from the array.
lnElem = ASCAN(this.aInstances, tcFormName)
IF lnElem > 0
lnRow = ASUBS(this.aInstances, lnElem, 1)
IF this.aInstances[lnRow, 3] = 1
*-- This is the last instance. Remove the row if more
*-- than one row exists
IF ALEN(this.aInstances, 1) > 1
=ADEL(this.aInstances, lnRow)
DIMENSION this.aInstances[ALEN(this.aInstances, 1) - 1, ALEN(this.aInstances, 2)]
ELSE
*-- Last array row. Just clear it out.
this.aInstances = .F.
ENDIF
ELSE
this.aInstances[lnRow, 3] = this.aInstances[lnRow, 3] - 1
ENDIF
ENDIF