Microsoft KB Archive/198887

= BUG: Incorrect Error Assigning Read-Only Property of UserControl =

Article ID: 198887

Article Last Modified on 5/13/2003

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Learning Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q198887



SYMPTOMS
When you attempt to assign a value to a read-only property of a UserControl object, the following error message is displayed. However, the error message is incorrect.

Compile Error: Wrong number of arguments or invalid property assignment.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.



Steps to Reproduce Behavior
 Create a new Standard EXE project in Microsoft Visual Basic. Form1 is created by default. From the Project menu, select Add User Control to add a UserControl object to the project.  Paste the following code into the code window of the UserControl: Property Get Test As Integer Test = 10 End Property  Close the UserControl design window. This enables the UserControl object on the Toolbox. Add the UserControl object to Form1 by dragging the UserControl object from the Toolbox to Form1.  Paste the following code in the declarations section of Form1: Private Sub Form_Load UserControl11.Test = 10 End Sub </li> Press the F5 key to run the project. The following error message is displayed:

Compile Error: Wrong number of arguments or invalid property assignment.

The expected error message is:

Compile Error: Can't assign to read-only property.

</li></ol>

Keywords: kbbug kbctrl kbpending KB198887

-

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

© Microsoft Corporation. All rights reserved.