BUG: Optional Argument Default Value Breaks Binary CompatibilityLast reviewed: January 16, 1998Article ID: Q176164 |
The information in this article applies to:
SYMPTOMSSetting 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" RESOLUTIONUse 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.
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.
MORE INFORMATIONA project containing the specification of this default value returns an error stating that the method for which the argument is defined is not Binary Compatible. This problem is specific to the use of vbNullString. It does not affect default values for Optional arguments in general.
Steps to Reproduce Behavior
Keywords : vb5all VBKBAutomation VBKBAX VBKBComp VBKBDLL Version : WINDOWS:5.0 Platform : WINDOWS Issue type : kbbug |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |