The information in this article applies to:
SYMPTOMSUsing a non-reserved Visual Basic keyword within a Property Procedure of the same name creates a recursive call to that Property statement resulting in this error:
CAUSE
Visual Basic allows you to define Properties and Methods that have the same
name as non-reserved keywords because many keywords (such as Left) in
previous versions of Visual Basic are used frequently by OLE servers. If
you take advantage of this in your own Class, an "Out of Stack Space error"
can occur in a Property Get Procedure when both of the following conditions
are met:
RESOLUTION
Typically, if one of the following conditions is true, Visual Basic can
determine whether to call the Property Get procedure or the non-reserved
keyword:
-or-
Because the Property Get Procedure expects 0 parameters and the Visual
Basic function expects 2, the Visual Basic Left function is called.If, however, the Property Get Procedure returns either a Variant or an Object, the Property Get Procedure is called, regardless of the number of Parameters the Property Procedure expects. This occurs because Objects, which are now supported in Variants, can have a default property, which can take parameters themselves. When you call a function that returns a Variant or Object, and you pass the incorrect number of parameters, Visual Basic realizes that you intended to pass the parameters to the default property of the Object, so it generates a call to the default property with those parameters. In this case, the "Incorrect Number of Parameters" message is not generated because it is not necessarily known how many parameters are expected by the default property. STATUSThis behavior is by design. MORE INFORMATIONSteps to Reproduce Behavior
Additional query words: 4.00 vb4win vb4all
Keywords : |
Last Reviewed: September 3, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |