Next, you must free the memory used by the form. This is the last operation in the main function of the program.
The program's main method calls the API's Destroy method to delete TheForm object.
' Now that we are done with the form, we can free the memory by
' calling Destroy. The object, 'TheForm', is a reference to
' the root node of the form. This causes the root node and all
' of its children (the complete form) to be deleted from memory.
Parent topic: Developing an application in Visual Basic