Hardware Reference
In-Depth Information
Table 6.5 Recommended Visual Basic variable naming
convention
Data type
Identifier
Example
Byte
b (prefix)
bPortData
Boolean
f (suffix)
ValidDataf
Integer
i (prefix)
iSetPoint
Long
l (prefix)
lResult
Single (floating point)
f (prefix)
fVelocity
Double (floating point)
df (prefix)
fFieldStrength
String
s (prefix)
sStatusText
Object
o (prefix)
oHeaderTank
Variant
v (prefix)
vMessage1
Table 6.6 Recommended Visual Basic control
naming convention
Control
Prefix
Example
CommandButton
cmd
cmdStart
Label
lbl
vStatus
OptionButton
opt
optFast
TextBox
tb
tbCurrentlResult
CheckBox
cb
cbHeatOn
Shape
sh
shLed
Timer
tmr
tmrOnTime
Although Visual Basic does not enforce the explicit declaration of variables
before they are used, this is now considered to be good practice. Furthermore,
it is also good practice to adopt a standard naming convention for variables,
objects, and code modules. Not only does this help to improve the readability
of the code but it will also assists considerably with maintenance and future
development. Table 6.5 is a recommended convention for naming variables
whilst Table 6.6 shows a recommended method of naming controls.
A
complete
example
of
a
Microsoft
Visual
Basic
program
appears
on
page 217. Further examples appear in Chapter 13.
PowerBASIC for
Windows
PowerBASIC for Windows provides a powerful alternative to Microsoft Visual
Basic for those who are prepared to move out of a Microsoft development
framework. For those who are willing to make the jump, Power BASIC for
Windows offers some considerable advantages not least of which is a significant
improvement in the execution of compiled code coupled with the ability to gen-
erate extremely compact executable programs. This, coupled with a deceptively
simple IDE (see Figure 6.9) makes this a very attractive alternative for software
development.
Search WWH ::




Custom Search