Udostępnij za pośrednictwem


Implementing class '<underlyingclassname>' for interface '<interfacename>' is not accessible in this context because it is '<accesslevel>'

An interface is declared with the CoClassAttribute specifying an underlying class, but that class has an access level that prevents the using code from accessing it.

Applying the CoClassAttribute to an interface associates an underlying class with the interface. This allows code to create an object directly from the interface using a New clause.

If the code using the New clause does not have access to the underlying class, for example if the class is Private, then the compiler generates this error.

Error ID: BC31109

To correct this error

  1. If you have source control over the underlying class, then adjust its access level so the using code can access it.

  2. If for any reason you cannot change the access level of the underlying class, then remove the New clause. You cannot create an object directly from this interface.

See Also

Concepts

Access Levels in Visual Basic

Reference

CoClassAttribute

New (Visual Basic)