What is the difference between Declaration and Instantiation an object?
Hello,
What is the difference between Declaration and Instantiation an object?
Regards,
Re: What is the difference between Declaration and Instantiation an object?
Dim obj as OBJ.CLASS with either
Set obj = New OBJ.CLASS or
Set obj = CreateObject(?OBJ.CLASS?)
or
Set obj = GetObject( ,? OBJ.CLASS?)
or
Dim obj as New OBJ.CLASS
Set object = Nothing ensure the object is release from the memory.
If this object is a form, you can add set myform = nothing and Form_Unload() event.Maintain a habit of remove the object by using set object = nothing which will benefit at last.
Visual Basic is supposed to automatically release objects when they go out of scope. To free up some memory usage, you can set the object to nothing.