| The names of procedures ,variables
and constants you declare in Visual
Basic have to follow certain rules.
- they must begin with a letter
- they cant contain embedded periods
or characters that specify a data
type (e.g ! or %)
- cant be longer than 255 characters
, names for forms / controls mustnt
exceed 40 characters
- cant be the same as restricted
keywords
- body of constant and variable
names should be mixed case with
capitals beginning each word
- constant and variable names should
be prefixed to indicate their data
type and scope
Variable Prefixes
|
Data type
|
Prefix
|
| Array
|
a
|
| Boolean
|
bln
|
| Byte
|
byt
|
| Collection
object |
col
|
| Currency
|
cur
|
| Date(time)
|
dtm
|
| Double
|
dbl
|
| Error
|
err
|
| Integer
|
int
|
| Long
|
lng
|
| Object
|
obj
|
| Single
|
sng
|
| String
|
str
|
| User-defined
type |
udt
|
| Variant
|
vnt
|
Here are some examples :
blnAccepted
bytAge
strFirstName
There is also suggested prefixes
for controls .
| Control type |
Prefix |
Control type
|
prefix |
| 3d panel |
pnl |
ADO data |
ado |
| Animated button |
ani |
Check box |
chk |
| Combo box |
cbo |
Command button |
cmd |
| Common dialog |
dlg |
Communications |
com |
| Control |
ctr |
Data |
dat |
| Data bound Combo |
dbcbo |
Data bound grid |
dbgrd |
| Data bound List
box |
dblst |
Data combo |
dbc |
| Data list |
dbl |
Data repeater |
drp |
| Date picker |
dtp |
Directory list box |
dir |
| drive list box |
drv |
file list box |
fil |
| flat scroll bar |
fsb |
Form |
frm |
| frame |
fra |
gauge |
gau |
| graph |
gra |
grid |
grd |
| header |
hdr |
hierarchical flex
grid |
flex |
| horizontal scroll
bar |
hsb |
image |
img |
| image combo |
imgcbo |
image list |
ils |
| label |
lbl |
lightweight check
box |
lwchk |
| lightweight combo |
lwcbo |
lightweight command
button |
lwcmd |
| lightweight frame |
lwfra |
lightweight horizontal
scroll bar |
lwhsb |
| lightweight list
box |
lwlst |
lightweight option
button |
lwopt |
| lightweight text
box |
lwtxt |
lightweight vertical
scroll bar |
lwvsb |
| line |
lin |
list box |
lst |
| list view |
lvw |
MAPI message |
mpm |
| MAPI session |
mps |
MCI |
mci |
| Menu |
mnu |
month view |
mvw |
| MS chart |
ch |
MS flex grid |
msg |
| MS tab |
mst |
OLE container |
ole |
| option button |
opt |
picture box |
pic |
| picture clip |
clp |
progress bar |
prg |
| remote data |
rd |
rich text box |
rtf |
| shape |
shp |
slider |
sld |
| spin |
spn |
status bar |
sta |
| sys info |
sys |
tab strip |
tab |
| text box |
txt |
timer |
tmr |
| toolbar |
tlb |
tree view |
tre |
| updown |
upd |
vertical scroll
bar |
vsb |
Variable scope
prefixes
| Scope |
Prefix |
| Global |
g |
| Module - level |
m |
| Class member |
m_ |
| local to procedure |
None |
Here is an example
msngTodayTemp : would
be a module level single that could
hold today's temperature.
|