BUG: "Function call on Left-hand side of assignment..." Error

Last reviewed: October 17, 1996
Article ID: Q150230
The information in this article applies to:
  • Standard, Professional, and Enterprise Editions of Microsoft Visual Basic, 16-bit and 32-bit, for Windows, version 4.0

SYMPTOMS

When a Read-Only property of a Text box is set in code, trying to run a project brings up the following error message:

   "Function call on left-hand side of assignment must return Variant or
   Object"

The environment shows a line of code that does not involve a property where an object or variant is necessary.

CAUSE

The problem with the code has nothing to do with the return value of a function. Although the error message is misleading and incorrect, it is an error to try and set a Read-Only property.

STATUS

Microsoft has confirmed this to be an issue in the Microsoft products listed at the beginning of this article. Microsoft is researching this issue and will post new information here in the Microsoft Knowledge Base as it becomes available.

WORKAROUND

Do not attempt to set a Read-Only property in code (by definition).

MORE INFORMATION

Steps to Reproduce Problem

  1. Start a new project in Visual Basic 4.0. Form1 is created by default.

  2. In the Form_Load event, place the following code:

          Private Sub Form_Load()
    
             Text1.HideSelection = False
          End Sub
    
    

  3. Run the program by pressing the F5 key. The error message occurs.


Additional reference words: 4.00 vb4win vb4all buglist4.00
KBCategory: kbprg kbbuglist
KBSubcategory: PrgOther


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 17, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.