PRB: Naming Conflicts Between Variables and Objects (129898)
The information in this article applies to:
- Microsoft Visual Basic Standard Edition, 32-bit, for Windows 4.0
- Microsoft Visual Basic Professional Edition, 16-bit, for Windows 4.0
- Microsoft Visual Basic Professional Edition, 32-bit, for Windows 4.0
- Microsoft Visual Basic Enterprise Edition, 16-bit, for Windows 4.0
- Microsoft Visual Basic Enterprise Edition, 32-bit, for Windows 4.0
This article was previously published under Q129898 SYMPTOMS
Conflicts between the names of various constructs produce errors in Visual
Basic version 4.0.
CAUSE
Problems of this type are caused by not taking into account the scope of
variables and objects. When a conflict occurs, Visual Basic gives
precedence to constructs of a narrower scope over those of a broader scope.
Some cases of this type can be handled by Visual Basic's design time syntax
checker, but others must be handled later (called late binding) in order to
permit more versatility.
RESOLUTION
Use unique names for variables, objects, and other constructs whenever
possible. When this is not possible, such as with type libraries, specify a
fully qualified name (for example, OpenDialog.Help_Button) to avoid
potential conflicts.
STATUS
This behavior is by design.
Modification Type: | Major | Last Reviewed: | 12/9/2003 |
---|
Keywords: | kbprb kbprogramming KB129898 |
---|
|