You should use a consistent prefix to name the object to make it easy to identify the type of object. The following lists Visual Basic
Some of the recommended objects are supported.
Recommended control prefix
Control type prefix example
3D PANEL PNL PNLGroup
Animated Button Ani Animailbox
Check Box Chk ChkReadonly
Combo Box, Drop-
Down List Box CBO CBOENGLISH
Command button cmd cmdexit
Common Dialog Dlg DlgfileOpen
Communications COM Comfax
Control (when specific
When the type is unknown,
CTR CtrCurrent used by Cheng
Data Control Datbiblio
Data-bound
Combo Box DBCBO DBCBOLANGUAGE
Data-Bound Grid DBGRD DBGRDQUERYRESULT
Data-bound
List Box DBLST DBLSTJOBTYPE
Directory
List box dir dirsource
Drive List box drv drvtarget
File List Box FilSource
Form FRM FRMENTRY
Frame fraranguage
Gauge Gau Gaustatus
Graph gra grandevenue
Grid GRD GRDPRICES
Horizontal
Scroll Bar HSB HSBVOLUME
Image IMG IMGICON
Key Status Key Keycaps
Label LBL LBLHELPMESSAGE
Line Lin Linvertical
List box Lst LstpolicycoDes
Mapi Message MPM MPMSentMessage
Mapi session MPS MPSSession
MCI MCI McIvideo
MDI Child Form MDI Mdinote
Menu Mnu Mnufileopen
MS Flex Grid Msg MsgClients
MS Tab MST MSTFIRST
Ole Ole Oleworksheet
Outline Out Outorgchart
Pen Bedit Bed Bedfirstname
Pen Hedit Hed Hedsignature
Pen Ink Ink Inkmap
Picture Pic Picvga
Picture CLIP CLP CLPToolbar
Report Rpt Rptqtr1Earnings
Shape SHP SHPCIRCLE
Spin SPN SpNpagestext Box Txt TxtlastName
Timer TMR Tmralarm
Updown UPD UPDDIRECTION
Vertical Scroll Bar vsb vsbrate
Slider SLD SLDScale
ImageList Ils Ilsallicons
TreeView Tre Treorganization
Toolbar TLB TLBACTIONS
Tabstrip Tab TabOptions
Statusbar Sta StadateTime
Listview lvw lvwheadings
ProgressBar PRG prgloadfile
RichtextBox RTF RTFreport
Recommended Data Access Object (DAO) prefix
Use the following prefix to indicate the data access object.
Database object prefix example
Container ConReports
Database DB DBACCOUNTS
DBENGINE DBE DBEJET
Document Doc DocsalesReport
FIELD FLD FLDDRESS
GROUP GRP GRPFINANCE
INDEX IDX IDXAGE
Parameter prmjobcode
QueryDef Qry QrysalesbyRegion
Recordset Rec Recforcast
RELATION REL RELEMPLOYEDEPT
Tabledef TBD TBDCUSTOMERS
User usr usrnew
Workspace WSP Wspmine
Some examples:
Dim Dbbiblio as Database
Dim Recpubsinny As Recordset, Strsqlstmt As String
Const db_readonly = 4 'Set constants.
'Open the database.
Set dbbiblio = OpenDatabase ("biblio.mdb")
'Setting the text for the SQL statement.
strsqlstmt = "SELECT * FROM PUBLISHERS WHERE _
State = 'ny' "
'Creating a new recordset object.
Set recubsinny = db.openRecordset (strsqlstmt, _
DBReadonly)
Recommended menu prefix
The application frequently uses many menu controls, which is very practical for these controls. apart from
In addition to the "MNU" tag, the prefix of the menu control should be extension: add an additional prefix for each nest.
, Place the header of the final menu in the final of the name string. The following table lists some examples.
Menu Title Sequence Menu Processor Name
File Open Mnufileopen
File Send Email Mnufilesendemail
File Send Fax Mnufilesendfax
Format Character MnuFormatcharacter
Help Contents MNUHELPCONTENTS
When using this naming convention, all members of a specific menu group take one column in Visual Basic
"Properties" window. Moreover, the name of the menu control clearly shows the menu items they belong.
Select prefix for other controls
For controls listed above, you should use the unique prefix consisting of two or three characters to standardize.
To maintain consistency. More than three characters are used only when it is necessary to clarify.
For example, for derived or modified controls, expand its prefix as described above, so that which control is truly used
Avoid confusion on the issue. For third-party controls, the manufacturer's lowercase abbreviation name should be attached to the prefix. E.g
A control instance created from the Visual Basic Professional 3D framework can be used with fra3d
Prefix to avoid confusing the control used.