ðH geocities.com /Baja/Dunes/7592/vbcc2.htm geocities.com/Baja/Dunes/7592/vbcc2.htm .delayed x MÔJ ÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈ °oÙ Ã OK text/html ÀÃg à ÿÿÿÿ b‰.H Fri, 10 Jul 1998 01:16:16 GMT Mozilla/4.5 (compatible; HTTrack 3.0x; Windows 98) en, * MÔJ Ã
Visual Basic Naming Conventions
Page 2
Previous Page
|
Home Page
|
VB Page
|
Next Page
Scope Information
There are also prefixes used to denote an object's scope. The scope prefixes come between the
type prefix and the object name, so you need to make sure that they start with an uppercase and
end with a lowercase letter. This way the scope will stand out from the type prefix and the
object itself. Examples some scope modifiers are Gb, for global, and Pi for private.
Variables
Variables are named in the following manner:
<type><scope><name>
The <name> is simply the variable name written with mixed case as described earlier. It is
considered bad practice to name a variable using the underscore character '_'. This character
is more commonly used for sub and function names.
EDITOR'S NOTE:
I like to leave the underscore character out of my sub and function names because in event
procedures in Visual Basic, it uses them to separate the control/form name from the event name for event
routines. When I glance at a routine name which contains an underscore, my first instinct is to
assume that it is an event procedure. ---O.C.
Local Variables do not have a scope prefix. Here are some examples of local variable definitions.
Dim nCount As Integer
Dim sQuery As String
Dim cUser As New CPerson
Private variables defined at the module level have Pi as a scope prefix.
Private nPiCount As Integer
Private sPiQuery As String
Private cPiUser As New CPerson
Public variables defined at the module level of a standard module (i.e. BAS file) have the scope prefix Gb
Public nGbCount As Integer
Public sGbQuery As String
Public anGbThisArray() As Integer
NOTE: Public variables defined at the module level of classes or Forms, are considered
Properties and do not have and scope or type prefix.
Functions and Subroutines
Public functions and subroutines have scope prefixes in the same way that variables do.
Public and private functions also use the type prefix to show what type of value they return.
The rules for choosing the type and scope prefix are the same as for variables.
Private subroutines and functions do NOT require scope prefixes. Here are some examples of private subroutines:
Private Sub ClearGrid()
Private Sub DeleteImportantInfo()
Previous Page
|
Home Page
|
VB Page
|
Next Page