Why Use A Visual Basic Class Library?
Maximising code re-use should be the goal of the Visual Basic programmer. All too frequently the same code is repeated in numerous forms and procedures.
From a management of view, using less code means greater productivity and faster development cycles. Forms, Reports and procedures can be built faster – and will run faster.
And best of all, having used a procedure repeatedly, the chance of an error is minimised.
Why A Class Library Is A Necessity
There are many reasons why a VB.Net Class Library should be used to remove repeated code:
- Improves performance – Applications load and run faster
- Memory – A shared resource reduces usage
- Security – intellectual property is better protected
- A common resource – the Class Library may be shared between different projects
- Stability – Applications becomes more robust and reliable
- Easier maintenance – code size and complexity is reduced
- End-user productivity – less training is needed with standardised and consistent software routines
- Crashes – errors are less likely to occur with shared and re-usable code
- Change management – simplified as only one Library modification needed
Hopefully the above will convince you that a VB.Net Class Library of re-usable procedures is essential.
I have collected many procedures over the years. It is an indispensable part of Application development.
Create a VB.Net Class Library
The best way to collect and maintain reusable code, is through the creation of a VB.Net Class Library.
All the code that you repeatedly use in Projects should be placed in the Library.
This will help avoid reinventing the wheel.
Eliminate Repeated Code In Visual Basic Procedures
Start by searching all source code for repeated procedures. Likely candidates are modules with:
- Error Handling
- ADO, ADO.Net and DAO database retrieval and updating
- Access database and SQL Server database handling
- Microsoft Word or Excel functions
- File Handling
- Consistent ActiveX Control colours
- Security control
- Validation and Formatting
- Company "About" form
Where variations in code procedures are found, select the best procedure, or handle the variation with Optional Arguments. This makes for powerful functionality.