Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
 
  Bug Proofing Visual Basic: Discussion: Naming Conventions  
 
Overview Table of Contents Updates
Source Code Comment Templates Sample Text
Discussion, Q & A Wiley Barnes & Noble
 
 
 

Naming Conventions

3/21/99 Norm LaBine started this discussion with some thoughts on the uses of naming conventions:

    Every now and then you ask yourself why there are so many people trying to tell you why their 'Convention' is better than others. Take VB and Office's various 'Conventions' for instance. accDefault and vbDefault = the MousePointer On/Off constant. Silly, IMHO. Same company, same language, same functionality.

    WELL, I found THE reason for a standard this morning in the MSKB: I searched for 'Text AND Database' as Keywords for VB. As usual, you get all the VBA junk with it, but I figured that the Excel and Access support guys, who usually write more comprehensive KB articles than the VB-folks, might have something specific for my search.

    Man! I got more than I bargained for!

    Check this article:
    XL: How to Create MS Access Database from MS Excel Using DAO
    http://support.microsoft.com/support/kb/articles/q151/5/66.asp

    But check this part:

    A Select Case statement is entered that looks at the left most letter of the NumberFormat property. The data type is created, based on this letter. If an "m", "d", or "y" is returned, the data type is set to "dbDate." If "G" is returned, the cell below it is formatted to "General." If this is the case, you need to determine if the cell contains a number or text.
    Can you imagine the simplicity of importing stuff, if all you have to do is prefix the Column names with some significant character? Why not the "Naming Convention Serves a Programming Purpose" instead of "Naming Conventions made for Employer Universality" (So the next guy can tweak your code). You'd probably see more Programmers standardize on a convention that really serves employers (less programming time to figure out what VarType a variable is) and more reliable programming results (Less debugging).

3/21/99 My response:
    I agree. I have used similar tricks on occasion. For example, using a leading letter in a ListBox's ItemData property to determine the kind of object. It's a useful trick whenever you use string data to refer to an object, as in a collection. I have not seen this done as universally as Norm proposes, though.

 

 
  Bug Proofing Visual Basic: Discussion: Naming Conventions  
 
Overview Table of Contents Updates
Source Code Comment Templates Sample Text
Discussion, Q & A Wiley Barnes & Noble
 
 
 

Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated