转至繁体中文版     | 网站首页 | 图文教程 | 资源下载 | 站长博客 | 图片素材 | 武汉seo | 武汉网站优化 | 
最新公告:     敏韬网|教学资源学习资料永久免费分享站!  [mintao  2008年9月2日]        
您现在的位置: 学习笔记 >> 图文教程 >> 软件开发 >> VB.NET程序 >> 正文
Visual Basic 6 Naming Standards         ★★★★

Visual Basic 6 Naming Standards

作者:闵涛 文章来源:闵涛的学习笔记 点击数:688 更新时间:2009/4/23 16:39:01

This contains the Microsoft Recommended naming conventions for Objects, and Variables in Visual Basic 6.0.

 

Why is this here? I believe it is always important to follow some standard when coding, and if your job involves VB programming, then I''''m sure you will agree that it definitely makes code easier to read and understand.  Most if not all, IT jobs will require you to follow a set of standards while writing your code. 

The Visual Basic Coding standards have changed over the years but they are still about the same, with the Scope and Type identifiers to tell if a variable is global, module or local, and what the data type of the variable is.  I remember the previous set of standards used only a single character type identifier. (most of the code in this site still uses the old standard, I just have not caught on to the new one yet.) The new standard of the 3 character type identifier makes VB''''s standards more like that of Visual C++. (I doubt this is coincidence.)

   

Visual Basic Naming Standards Control type prefix Example 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 (used within procedures when the specific type is unknown) 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 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

 

  Variable Naming Conventions

Visual Basic uses a Scope and Type identifier to prefix each variable name, so it is easy to tell the data type of the variable and where the variable is declared. The Scope can be one of three things:

Scope Prefix Example Global g gstrUserName Module-level m mblnCalcInProgress Local to procedure None dblVelocity

The Type identifier follows the Scope identifier and will enable anyone looking at your code to instantly know the data type of all your variables without having to look for the variables declaration. The following is a list of the data types and their prefixes:

Data type Prefix Example 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

So if you had a global variable named "Counter" and it is a long, you would name the variable "glngCounter" Anyone looking at this variable would instantly know the variable is global to the whole project and would know it is a long. In a multi-developer environment this type of standard is a must, or else there will be considerable time lost while each developer keeps referring to the variable declarations.


[系统软件]Visual Studio 2005 Express Beta Products 下载链…  [系统软件]Visual FoxPro9.0中扩展报表系统功能
[系统软件]Visual FoxPro:我是旁观者  [系统软件]Visual Studio 2005 Express Editions Beta 2 下载…
[系统软件]BCB6 下devexpress 安装手记  [系统软件]Boost库在XP+Visual C++.net中的安装
[系统软件]Visual Studio 2005 Express Edition 正式版下载地…  [常用软件]Internet Explorer 6 Public Preview 最新出击!!
[常用软件]painter 6 手绘实例《油彩篇》  [常用软件]painter 6 手绘实例《粉彩篇》
教程录入:mintao    责任编辑:mintao 
  • 上一篇教程:

  • 下一篇教程:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      注:本站部分文章源于互联网,版权归原作者所有!如有侵权,请原作者与本站联系,本站将立即删除! 本站文章除特别注明外均可转载,但需注明出处! [MinTao学以致用网]
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)

    同类栏目
    · C语言系列  · VB.NET程序
    · JAVA开发  · Delphi程序
    · 脚本语言
    更多内容
    热门推荐 更多内容
  • 没有教程
  • 赞助链接
    更多内容
    闵涛博文 更多关于武汉SEO的内容
    500 - 内部服务器错误。

    500 - 内部服务器错误。

    您查找的资源存在问题,因而无法显示。

    | 设为首页 |加入收藏 | 联系站长 | 友情链接 | 版权申明 | 广告服务
    MinTao学以致用网

    Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved.
    闵涛 投放广告、内容合作请Q我! E_mail:admin@mintao.net(欢迎提供学习资源)

    站长:MinTao ICP备案号:鄂ICP备11006601号-18

    闵涛站盟:医药大全-武穴网A打造BCD……
    咸宁网络警察报警平台