公司软件部VB组代码撰写暂行约定 probezy(转贴)
出处 http://www.vbprobe.com
一、变量和对象
程序中的变量遵循匈牙利表示法,即“前缀+变量含义”,变量的含义为一个或多个英文单词,每个单词的第一个字母大写,不要用汉语拼音代替。变量前缀为三个小写字母示意其类型,所需添加的前缀遵循微软在MSDN中的建议。列表如下:
基本数据类型
变量类型 前缀 示例
Boolean bln blnFound
Byte byt bytRasterData
Collection object col colWidgets
Currency cur curRevenue
Date (Time) dtm dtmStart
Double dbl dblTolerance
Error err errOrderNum
Integer int intQuantity
Long lng lngDistance
Object obj objCurrent
Single sng sngAverage
String str strFName
User-defined type udt udtEmployee
Variant vnt vntCheckSum
控件或窗体、模块对象
控件类型 前缀 示例
3D Panel pnl pnlGroup
ADO Data ado adoBiblio
Animated button ani aniMailBox
Check box chk chkReadOnly
Combo box, drop-down list box cbo cboEnglish
Command button cmd cmdExit
Common dialog dlg dlgFileOpen
Communications com comFax
Control (在过程中使用的类型未明的控件变量)
ctr ctrCurrent
Data dat datBiblio
Data-bound combo box dbcbo dbcboLanguage
Data-bound grid dbgrd dbgrdQueryResult
Data-bound list box dblst dblstJobType
Data combo dbc dbcAuthor
Data grid dgd dgdTitles
Data list dbl dblPublisher
Data repeater drp drpLocation
Date picker dtp dtpPublished
Directory list box dir dirSource
Drive list box drv drvTarget
File list box fil filSource
Flat scroll bar fsb fsbMove
Form frm frmEntry
Frame fra fraLanguage
Gauge gau gauStatus
Graph gra graRevenue
Grid grd grdPrices
Hierarchical flexgrid flex flexOrders
Horizontal scroll bar hsb hsbVolume
Image img imgIcon
Image combo imgcbo
imgcboProduct ImageList ils
ilsAllIcons Label lbl
lblHelpMessage Lightweight check box
lwchk lwchkArchive Lightweight combo box
lwcbo lwcboGerman
Lightweight command button
lwcmd Month view
mvw mvwPeriod
MS Chart ch chSalesbyRegion
MS Flex grid msg msgClients
MS Tab mst mstFirst
OLE container ole oleWorksheet
Option button opt optGender
Picture box pic picVGA
Picture clip clp clpToolbar
ProgressBar prg prgLoadFile
Remote Data rd rdTitles
RichTextBox rtf rtf