Class '<classname1>' must declare a 'Sub New' because its base class '<classname2>' has more than one accessible 'Sub New' that can be called with no arguments

A derived class does not declare a constructor, and Visual Basic cannot generate one because it cannot determine which base class constructor to call.

When a derived class does not declare a constructor, Visual Basic attempts to generate an implicit parameterless constructor that calls MyBase.New(). If there is no accessible constructor in the base class that can be called without arguments, or if there is more than one, Visual Basic cannot generate an implicit constructor.

This situation can arise, for example, if one base class constructor has a single Optional argument and another has a single ParamArray argument. Each of these can be called with no arguments.

Error ID: BC32036

To correct this error

  1. Declare and implement at least one Sub New constructor somewhere in the derived class.

  2. Add a call to a base class constructor, MyBase.New(), as the first line of every Sub New.

See Also

Concepts

Object Lifetime: How Objects Are Created and Destroyed

Optional Parameters

Parameter Arrays

Reference

Using Constructors and Destructors

Optional (Visual Basic)

ParamArray