Udostępnij za pośrednictwem


Constructor '<name>' cannot call itself

A Sub New procedure in a class or structure calls itself.

The purpose of a constructor is to initialize an instance of a class or structure when it is first created. A class or structure can have several constructors, provided they all have different parameter lists. A constructor is permitted to call another constructor to perform its functionality in addition to its own. But it is meaningless for a constructor to call itself, and in fact it would result in infinite recursion if permitted.

Error ID: BC30298

To correct this error

  1. Check the parameter list of the constructor being called. It should be different from that of the constructor making the call.

  2. If you do not intend to call a different constructor, remove the Sub New call entirely.

See Also

Concepts

Object Lifetime: How Objects Are Created and Destroyed