Visual Basic for Applications Reference

Visual Studio 6.0

Can't call Friend procedure on an object that isn't an instance of the defining class (Error 97)


A Friend procedure is callable from a module that is outside the class, but part of the project within which the class is defined. This error has the following causes and solutions:

  • You tried to call the Friend procedure of a class. Although your reference variable is of the proper type, the variable points to an instance that isn't an instance of the class.

    For example, this can occur if there are two classes, classics and classy (that implements classy), but you mistakenly assign the instance of classy to the instance of classics.

  • You tried to access a Friend property or method either cross-process or cross-thread. Friend procedures are not part of a class's public interface, so they cannot be marshaled cross-process or cross-thread.

For additional information, select the item in question and press F1.