devxlogo

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 oCustEnd Sub

The right way is:

 Private Sub Foo()    Dim oCust as clsCust    Set oCust = New clsCust    'do stuff with oCust    Set oCust = NothingEnd Sub

Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.

See also  How Engineering Leaders Spot Weak Proposals

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.