BUG: Incorrect Error Assigning Read-Only Property of UserControl (198887)



The information in this article applies to:

  • Microsoft Visual Basic Learning Edition for Windows 6.0
  • Microsoft Visual Basic Professional Edition for Windows 6.0
  • Microsoft Visual Basic Enterprise Edition for Windows 6.0

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.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a new Standard EXE project in Microsoft Visual Basic. Form1 is created by default.
  2. From the Project menu, select Add User Control to add a UserControl object to the project.
  3. Paste the following code into the code window of the UserControl:
       Property Get Test() As Integer
          Test = 10
       End Property
    					
  4. Close the UserControl design window. This enables the UserControl object on the Toolbox.
  5. Add the UserControl object to Form1 by dragging the UserControl object from the Toolbox to Form1.
  6. Paste the following code in the declarations section of Form1:
       Private Sub Form_Load()
          UserControl11.Test = 10
       End Sub
    					
  7. 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.

Modification Type:MajorLast Reviewed:5/13/2003
Keywords:kbBug kbCtrl kbpending KB198887