Bagikan melalui


Object Naming Conventions

Follow this suggested format for naming objects.

PrefixName

Suggested prefixes for object names are listed in the following table.

Prefix Object Example
chk CheckBox
chkReadOnly
col Collection
colFormObjects
cbo ComboBox
cboEnglish
cmd CommandButton
cmdCancel
cmg CommandGroup
cmgChoices
cnt Container
cntMoverList
ctl Control
ctlFileList
cad CursorAdapter
cadInventory
<user-defined> Custom
user-defined
dte DataEnvironment
dteSalesForm
edt EditBox
edtTextArea
frm Form
frmFileOpen
frs FormSet
frsDataEntry
grd Grid
grdPrices
grc Column
grcCurrentPrice
grh Header
grhTotalInventory
hpl HyperLink
hplHomeURL
img Image
imgIcon
lbl Label
lblHelpMessage
lin Line
linVertical
lst ListBox
lstPolicyCodes
olb OLEBoundControl
olbObject1
ole OLE
oleObject1
opt OptionButton
optFrench
opg OptionGroup
opgType
pag Page
pagDataUpdate
pgf PageFrame
pgfLeft
prj ProjectHook
prjBuildAll
sep Separator
sepToolSection1
shp Shape
shpCircle
spn Spinner
spnValues
txt TextBox
txtGetText
tmr Timer
tmrAlarm
tbr ToolBar
tbrEditReport
xad XMLAdapter
xadRemoteXMLData
xfd XMLField
xfdPrices
xtb XMLTable
xtbInventory

Remarks

Prefixes aren't required, but are recommended as good programming practice. Using a prefix does not dictate the contents of an object variable — in Visual FoxPro, prefixes are used only as a naming convention. For example, adding the prefix "cbo" does not check that the object referenced by the variable is a combo box, but it does help you remember the object referenced by the variable.

For more information, see Visual FoxPro Naming Rules.

See Also

Constant Naming Conventions | Table Field Naming Conventions | Variable Naming Conventions | Visual FoxPro Naming Rules | Window Naming Conventions