Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Enterprise
Expertise: Intermediate
May 5, 1998



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Declare Your Objects Properly

Never declare a variable as a "New" of type "object," but always rather just as of type "object." If you do so you will always increment the reference count of the object, even though you do not use it. Also, always remember to set your objects to nothing when finished. The wrong way is:
Private Sub Foo()
    Dim oCust as New clsCust

    'do stuff with oCust

End Sub
The right way is:
Private Sub Foo()
    Dim oCust as clsCust

    Set oCust = New clsCust
    'do stuff with oCust
    Set oCust = Nothing

End Sub
Joe Karbowski
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date