delete();
The delete method of the Form class or Control class has additional meaning when the object has an associated Windows form or control. Deleting such an object causes the object of the window to be destroyed as well.
The delete method, which is the destructor method for the Form or Control class and its subclasses, is automatically invoked when an instance of the Form or Control class or subclass is deleted. You cannot call this method directly.
Deleting a running form causes the form to be unloaded and destroyed, and the transient form and control objects to be deleted. Deleting a control causes that control to be removed from its owner form. No further events are issued for the window that is being deleted, as the object is not available to receive these events.
Deleting a form queues the window for deletion, but if another window is deleted before the next idle point, previously queued deleted windows are re-evaluated for deletion. If the queued window or its children have no outstanding Windows message, there are no incomplete event methods for that window or its children, and the method that created the window has exited or the window was deleted, the physical window is deleted.
If you want the queryUnload and unload events to occur when your form is deleted, use the unloadForm method instead of the delete method.
To ensure that a form has no orphaned children when deleting a window, the lowest child in the hierarchy is deleted first, followed by the next lowest child, and so forth up the hierarchy until the parent is deleted. You therefore do not need to handle the deletion the children of a form in your code, as the child or children no longer exist when the parent is deleted.
Avoid referring to user-defined properties or methods on the