Microsoft KB Archive/90900

= PRB: Parameter Type Mismatch When Don't Pass Property By Val =

Article ID: 90900

Article Last Modified on 8/16/2005

-

APPLIES TO


 * Microsoft Windows 2000 Readiness Analyzer
 * Microsoft Visual Basic 1.0 Standard Edition
 * Microsoft Visual Basic for MS-DOS

-



This article was previously published under Q90900



SYMPTOMS
When using a property of a control as an argument to a SUB or FUNCTION statement, make sure that the property is passed by value, not by reference. If you do not, you may receive the error message

Parameter type mismatch



STATUS
This behavior is by design.



MORE INFORMATION
Not all properties of all controls require passing by value, but most do. For compatibility with any type of control property, you should pass by value. You can pass the parameter by value in one of two ways:

  You can define the parameter ByVal in the SUB definition: SUB Sub1(ByVal x AS INTEGER, y AS INTEGER) PRINT x, y   END SUB Call Sub1(Check1.Value, 10)   You can pass the parameter argument by value in the Call by placing parentheses &quot;&quot; around the argument. SUB Sub1(x AS INTEGER, y AS INTEGER) PRINT x, y  END SUB Call Sub1((Check1.Value), 10) 

Additional query words: VBmsdos

Keywords: kbprb KB90900

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.