×

VB代码撰写约定

Kalet Kalet 发表于2009-03-20 12:00:13 浏览198 评论0

抢沙发发表评论

确认框(Check Box) chk chkCareerChioce     
组合框(Combo Box) cbo cboCrimesCommitted     
命令钮(Command Button) cmd cmdExit      VB代码撰写约定
数据库控件(Data Control)  dat datTopSecretInfo     
目录列表框(Directory List Box)dir dirTree     
驱动器列表框(Drive List Box)drv drvHardDisk     
文件列表框(File List Box) fil filDocuments     
窗体(Form)        frm frm1040Tax     
框架(Frame)          fra fraGroupButtons     
水平滚动条(Horizontal Scroll Bar) hsb hsbTemperature     
图形(Image)          img imgPrettyDrawing     
标签(Label)          lbl lblFakeName     
线(Line)           lin linBorder     
列表框(List Box)  lst lstCandidates     
菜单(Menu)          mnu mnuHamAndEggs     
选项钮(Option Button)  opt optStation101     
图形框(Picture Box)  pic picPrettyPicture     
几何图形(Shape)            shp shpUpOrShipOut     
文本框(Text Box)  txt txtWarning     
垂直滚动条(Vertical Scroll Bar)  vsb vsbMoneyRaised 


      
  这是一家公司软件部规定的VB组代码撰写暂行约定。对于VB项目的协同开发有一定的帮助和指导。  
   
  一、变量和对象        
  程序中的变量遵循匈牙利表示法,即“前缀+变量含义”,变量的含义为一个或多个英文单词,每个单词的第一个字母大写,不要用汉语拼音代替。变量前缀为三个小写字母示意其类型,所需添加的前缀遵循微软在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     VB代码撰写约定
  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     lwcmdRemove    
  Lightweight   frame     lwfra     lwfraSaveOptions    
  Lightweight   horizontal   scroll   bar     lwhsb     lwhsbVolume    
  Lightweight   list   box     lwlst     lwlstCostCenters    
  Lightweight   option   button     lwopt     lwoptIncomeLevel    
  Lightweight   text   box     lwtxt     lwoptStreet    
  Lightweight   vertical   scroll   bar     lwvsb     lwvsbYear    
  Line     lin     linVertical    
  List   box     lst     lstPolicyCodes    
  ListView     lvw     lvwHeadings    
  MAPI   message     mpm     mpmSentMessage    
  MAPI   session     mps     mpsSession    
  MCI     mci     mciVideo    
  Menu     mnu     mnuFileOpen    
  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     rtfReport    
  Shape     shp     shpCircle    
  Slider     sld     sldScale    
  Spin     spn     spnPages    
  StatusBar     sta     staDateTime    
  SysInfo     sys     sysMonitor    
  TabStrip     tab     tabOptions    
  Text   box     txt     txtLastName    
  Timer     tmr     tmrAlarm    
  Toolbar     tlb     tlbActions    
  TreeView     tre     treOrganization    
  UpDown     upd     updDirection    
  Vertical   scroll   bar     vsb     vsbRate      
       
  数据库对象      
   
  数据库对象     前缀     示例    
  Container     con     conReports    
  Database     db     dbAccounts    
  DBEngine     dbe     dbeJet    
  Document     doc     docSalesReport    
  Field     fld     fldAddress    
  Group     grp     grpFinance    
  Index     ix     idxAge    
  Parameter     prm     prmJobCode    
  QueryDef     qry     qrySalesByRegion    
  Recordset     rec     recForecast    
  Relation     rel     relEmployeeDept    
  TableDef     tbd     tbdCustomers    
  User     usr     usrNew     VB代码撰写约定
  Workspace     wsp     wspMine 



群贤毕至

访客