Community articleDestroy function
Added by IBM contributorIBM on July 26, 2013
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars


This function destroys the indicated IFormNodeP and all of its child nodes.


 Sub Destroy()


There are no parameters for this function.


Nothing if call is successful or throws an exception if an error occurs.

Usage details

Digital signatures
This function will not destroy a signed item, except in the case of destroying an entire signed form. Attempting to destroy a signed item causes an exception.


The following function uses GetChildren and GetNext to walk through an entire form and deletes all information that is not in the XFDL namespace. The function uses IsXFDL to determine which nodes are in the XFDL namespace. Note that the function assumes that you are passing the root node of the form on the first call. Subsequent calls occur through recursion, which may provide any level of node.
   Sub DeleteCustomInfo(Node)
      Dim MainNode, TestNode  ' objects
      Dim TempInt
      ' Set the MainNode to be the child of the provided node.
      Set MainNode = Node.GetChildren
      ' Use recursion to step through each node in the form.  This routine
      ' walks to the last node in each page, then traverses back up the tree,
      ' deleting nodes that are not in the XFDL namespace as it goes.
      Do While (Not(MainNode Is Nothing))
         Set TestNode = MainNode.getNext
         Set MainNode = TestNode
      ' Check to see if the node passed to the routine is in the XFDL
      ' namespace.  If not, delete the node.
      If Node.isXFDL = False Then
      End If
   End Sub

Parent topic:
FormNodeP functions