Cool Visual Basic
 
Main
Frequently Asked Questions
VB Helpdesk
Message Boards
Library
Downloads
View Guestbook
Add to Guestbook
Product Reviews
Bookstore
Links
Newsgroups
Vendors
Affiliates
Cooltech.org

This page document naming conventions for Visual Basic.

Variables

Name      short prefix    long prefix   postfix letter
   
integer       i              int(not used)  %
long          l              lng            &
single        s              sng            !
double        d              dbl            #
variant       vnt            vnt
string        s              str(not used)  $

You might notice that the long prefix for integer and string are not used. The reason is that the long prefixes are only used on high-precision(long, single, and double) variables to help them stand out. Also note that the variant short and long prefixes are identical so that they stand out(Also, variants should be avoided whenever possible. They impact your speed and can also cause type errors). One note: It is a recommended guideline that you put Option Explicit on all of your modules. This will ensure that you do not have variable spelling mistakes.

Controls


Name                  Prefix  
      
Command Button        cmd
3D Command Button     cmd
Label                 lbl
Text Box              txt
Rich Text Box         rtf
Form                  frm
Module                mod
Tab control           tab
SSTab Control         sst
Common Dialog         dlg
MsComm                com
Option Button	      opt
Check Button          chk
Menu                  mnu


Form/Module Extensions


If it contains                  then the extension should be  
               a Form                 .frm
               a class                .cls
               a module               .bas
               global declarations    .glo or .gbl

I hope you find this document useful.


Copyright 2006, David J Berube<Form1@coolvb.com>. All Rights Reserved.