FIX: Optional Argument Default Value Breaks Binary Compatibility (176164)
The information in this article applies to:
- Microsoft Visual Basic Learning Edition for Windows 5.0
- Microsoft Visual Basic Professional Edition for Windows 5.0
- Microsoft Visual Basic Enterprise Edition for Windows 5.0
This article was previously published under Q176164 SYMPTOMS
Setting the default value of an Optional String argument to vbNullString
causes the following error when the project is compiled with Binary
Compatibility:
"<procedure> in the <class> class module has arguments and/or a return
type that is incompatible with a similar declaration in the
version-compatible component"
RESOLUTION
Use quotation marks instead of vbNullString. For example:
Optional myString as String = ""
You may also see the error:
"Variable uses an automation type not supported in Visual Basic (Error 458)."
This occurs when you attempt to set the default value of a Variant optional
argument to Null. Avoid using any of the null-related constants (vbNull,
vbNullString, etc.) when providing a default value for an optional
argument.
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article. This bug has been fixed in Visual Basic
6.0.
Modification Type: | Major | Last Reviewed: | 11/18/2003 |
---|
Keywords: | kbbug kbfix KB176164 |
---|
|