PRB: Capitalization in Visual Basic 4.0 Differs from 3.0Last reviewed: October 30, 1995Article ID: Q129712 |
The information in this article applies to:
SYMPTOMSVariable case is persistent after the first reference of the variable has been set.
CAUSEThis happens because Visual Basic maintains a single name table for the entire project where all names that are not case-sensitive are stored as a single entry. This forces all occurrences of the same name, regardless of where it is used (Sub procedure, parameter, dim, type, or whatever), to be treated the same. The names are based on where they are declared. The case of the name in the last Declare statement always wins. Each name is tagged in the name table with whether or not it has a corresponding Declare statement. If it does, any access to the name from a statement that is not a Declare statement causes the new name to have the same case as the name in the name table.
STATUSThis behavior is by design. This design brings Visual Basic for Windows behavior more in line with the embedded version of Visual Basic, Applications Edition in Excel and other Microsoft products.
MORE INFORMATIONVariable case in form files (.FRM) and modules (.BAS) in Visual Basic version 4.0 is handled differently from the way it was handled in version 3.0. In Visual Basic for Windows version 3.0, the case of your variables was decided by the most recent line parsed by the environment containing the variable. This behavior changed in Visual Basic version 4.0. When you first define a variable either by explicitly declaring it or implicitly by referencing the variable in a line that gets parsed (assuming Option Explicit is not enforced), that is the case that will be used throughout your program. This occurs for all variables in scope at the line where the variable name is referenced.
Steps to Reproduce BehaviorIn Visual Basic version 3.0:
|
Additional reference words: 4.00 case sensitivity insensitive insensitivity
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |