Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do you know any style guide for VB6?

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?

like image 667
systempuntoout Avatar asked Jun 25 '10 14:06

systempuntoout


People also ask

What are naming conventions in Visual Basic?

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).

What is the purpose of control naming convention?

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.

What is the importance of naming a control in Visual Basic?

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 is coding standards in software engineering?

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.


4 Answers

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.

like image 51
Ben McCormack Avatar answered Oct 15 '22 08:10

Ben McCormack


Microsoft's own coding guidelines in the VB6 manual are pretty good.

  • Like Darryl says, when editing existing code, it's best to match the naming conventions, indenting, and commenting style in the existing routine or module. You can be more creative when creating new modules.
  • However there are some best practises that should always be applied (e.g. before editing a module without Option Explicit I would add Option Explicit before doing anything else).
like image 23
MarkJ Avatar answered Oct 15 '22 08:10

MarkJ


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.

like image 44
Darrel Miller Avatar answered Oct 15 '22 10:10

Darrel Miller


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).

like image 32
jjb Avatar answered Oct 15 '22 08:10

jjb