Knowledge Base

PRB: Early Binding Fails with Out-Of-Process OLE Servers

Article ID: 137094

Article Last Modified on 11/18/2003


APPLIES TO


This article was previously published under Q137094

SYMPTOMS

When performing early binding on an out-of-process OLE server class, you might expect the Visual Basic 4.0 compiler to detect references made to invalid methods or properties. Yet, sometimes such invalid references are ignored by the compiler and are only detected at run time.

CAUSE

There are two probable causes for this problem:

  • Improper declaration of object variable. For early binding to work, you must declare your object variable as follows:
          Dim MyObjectVar As New MyServer.MyClass
    						
    If you use the following, early binding will not work:
          Dim MyObjectVar As Object
    						
    -or-

  • Compile On Demand option is set on. Click Options on the Tools menu, and click the Advanced tab. The Compile On Demand option must be set to false for the compiler to detect references made to invalid methods or properties in the server class.

STATUS

This behavior is by design.

Additional query words: 4.00 vb4win vb4all

Keywords: kbprb KB137094