I code with Vb6 everyday using my own convention and i'm starting to feel guilty about that.
Do you know any style guides for VB6 like naming convention, code techniques and best practices?
When you name an element in your Visual Basic application, the first character of that name must be an alphabetic character or an underscore. Note, however, that names beginning with an underscore are not compliant with the Language Independence and Language-Independent Components (CLS).
In general, a naming convention provides a set of rules for choosing the sequence of characters to identify variables, functions and other elements within code or its documentation.
By using name property programmer can access the other properties of the controls and methods as well at run time. Visual Basic gives default name to the controls which can be later changed by changing it's name property at the design time or urn time.
What are Coding Standards? Think of coding standards as a set of rules, techniques, and best practices to create cleaner, more readable, more efficient code with minimal errors. They offer a uniform format by which software engineers can use to build sophisticated and highly functional code.
Despite VB6's infamy in legacy codebases, it is still used heavily every day in lots of enterprises and it will benefit from good style.
As Darrel suggested, be consistent with existing code bases.
However, if you have freedom in how you style your code, you might choose the Reddick VBA Naming Convention (VBA is the same codebase as VB6). It's recommended in the VBA Developer's Handbook. Granted, a lot of its style will feel obsolete in the .NET environment, but it does seem to be heavily used a lot in VB6 and VBA examples.
Microsoft's own coding guidelines in the VB6 manual are pretty good.
Option Explicit
I would add Option Explicit
before doing anything else).I would not be concerned with any "standard" style for VB6 coding at this point. The important thing is that you are consistent with the existing code base.
I found Practical Standards for Microsoft Visual Basic to be quite good. It's from the classic vb era and is available for as little as 1 cent (plus delivery).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With