[Home][What's New][About][How To][Q&A Forum][Tutorials][Standards][Articles][Links][Contact Page][Mail Us][Guest Book][Join][Copyright][Privacy Statement][Disclaimer][DigitalSA]



Google
Naming Standards: Controls

  1. Controls should always be named, even if you are never going to refer to them in coding. Don't use the default names, e.g. Label1, Command1, Picture1, Text1, ...

  2. Apply the general naming standards as discussed under General.

  3. Use the same name for related items, e.g. A variable called "AccountNumber" would be displayed in a Text box called "txtAccountNumber" which is described by a label called "lblAccountNumber". (Don't use "AccountNum" in one and "AccNo" in another.)

  4. Prefix all controls to identify their type. Below is a list of the most commonly used controls and their prefixes. If the prefixes in the list differ from standards that you are currently using, rather stick to your existing standard - it is more important to be consistent.

  5. For some or other reason it is popular to differentiate between horizontal scrollbars and vertical scrollbars, as in hscLevel and vscLevel, even though they are exactly the same control with the "Orientation" property set to different values. This makes as much sense as prefixing all controls on the left side of the form with "L" and all controls on the right with "R", so I don't use it at all.

  6. It doesn't add any value to distinguish between controls of different "flavours" or from different suppliers. For example, all my command buttons are prefixed with "cmd" regardless of whether they are the intrinsic VB controls or from the Sheridan 3D controls, or whatever third party creator. They are all in essence command buttons, so I use "cmd".

    
Intrinsic Controls and Modules
ControlPrefix Example
Picture box
pic
picGraph
Label
lbl
lblFirstName
Text Box
txt
txtFirstName
Frame
fra
fraDetails
Command Button
cmd
cmdExit
Check Box
chk
chkSaveSettings
Option Button
opt
optSizeLarge
Combo Box
cbo
cboObjectTypes
List Box
lst
lstObjects
Horizontal Scrollbar
scl
sclTemperature
Vertical Scrollbar
scl
sclLevel
Timer
tmr
tmrCheck
Drive List Box
drv
drvBackupFile
Directory List Box
dir
dirBackupFile
File List Box
fil
filBackupFile
Shape
shp
shpCircle
Line
lin
linSeperator
Image
img
imgLogo
Data Control
dat
datCustomers
OLE Container
ole
oleExcelGraph
Menu Items
mnu
mnuFileExit

Modules
Form & MDI Form
frm
frmMain
Class Module
C
CAnimal
Basic Module
bas
basRoutines


External Controls
ControlPrefixExample
Tab Strip
tab
tabSettings
Toolbar
tlb
tlbEdit
Status Bar
sts
stsDocument
Progress Bar
prg
prgConvert
Tree View
tvw
tvwProject
List View
lvw
lvwResults
Image List
iml
imlIcons
Slider
sld
sldLevel
Image Combo
imc
imcTools
Animation
ani
aniSearch
Up Down (Spin) Control
spn
spnMargin
Month View
mth
mthSchedule
Date Time Picker
dtp
dtpStartDate
Flat Scroll Bar
scl
sclImage
Picture Clip
clp
clpCards
Coolbar
clb
clbNavigate
Rich Text Box
rtf
rtfMedia
Flex Grid
grd
grdTransactions
Common Dialogue
cdl
cdlFile


Back to Standards Page

[Home][What's New][About][How To][Q&A Forum][Tutorials][Standards][Articles][Links][Contact Page][Mail Us][Guest Book][Join][Copyright][Privacy Statement][Disclaimer][DigitalSA]


Shrog mailing list. Enter email address:

© Copyright 2000 by Robert Terblanche (Robert@Shrog.iwarp.com). All rights reserved. For more info see our Copyright Statement.

All information on this site is used at your own risk. For more details see our Disclaimer Statement.



Beta