Pharfruminsain

About The Variable Naming Tutorial

There are a lot of programmers that don't properly indicate what type of variable they are using. The best way to make your code understandable for others and yourself is to properly preceed your variables and objects with an easy to understand prefix.

As a general rule (not always applied) it is best to prefix variables with a single letter, and prefix objects with three letters. Just follow the chart below.

This list is not an official prefix list. It's only a suggestion list using naming conventions I was taught, as well as a few official Microsoft naming conventions.

Variable Prefixes

PrefixVariable Type
bBoolean
cCurrency
dDouble
fSingle
iInteger
lLong
rShort
sString
tDate or Time
vVariant
yByte

Object Type

PrefixObject Type
btnButton
calCalendar
cboComboBox
chkCheckBox
cmdCommand Button
dirDirectory ListBox
dlgCommon Dialog Box
drvDrive Selector
dtpDate Picker
filFile ListBox
fraFrame
frmForm
iltImageList
imgImage
lblLabel
lstListBox
lvwListView
mnuMenu Item
nudNumericUpDown
objObject
optRadio (Option) Button
picPicture Box
prgProgress Bar
sbrStringBuilder
tkbTrackBar
tmrTimer Control
txtTextBox