BUG: Compiler Error with Left Function When Devshll.dll Is Referenced (276560)



The information in this article applies to:

  • Microsoft Visual Basic Enterprise Edition for Windows 6.0

This article was previously published under Q276560

SYMPTOMS

When you use the Left string function in Visual Basic and your project contains a reference to Microsoft Visual C++ Shared Objects (Devshl.dll), you may receive the following compiler error message:
Wrong number of arguments or invalid property assignment

This does not occur when you use a form module, but may occur when you use a standard or class module.

CAUSE

The compiler seems to resolve the Left function in Devshl.dll instead of in the VBA library. Because Left is a property of the Application and Window objects in Devshl.dll, you receive an error when you call Left as a function.

RESOLUTION

Fully qualify the call to the Left function, as in the following example:
Sub foot()

    Dim s As String
    s = "skdfhshfsdlkf"
    s = VBA.Left(s, 3) 'Fully qualified
    
End Sub
				

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

Steps to Reproduce Problem

  1. In Visual Basic version 6.0, create a new Standard EXE project. Form1 is created by default.
  2. Add a class module to the project.
  3. Add the following code to the class module:
    Sub foot()
        Dim s As String
        s = "skdfhshfsdlkf"
        s = Left(s, 3)
    End Sub
    					
  4. Set a reference to Visual C++ Shared Objects (Devshl.dll).
  5. Press CTRL+F5 to start the application with full compile. You receive the error message listed in the "Symptoms" section.

Modification Type:MajorLast Reviewed:10/15/2002
Keywords:kbBug kbCompiler kbDSupport KB276560