The designer must create an instance of…cannot because the type is declared abstract

前端 未结 3 890
小鲜肉
小鲜肉 2021-02-03 19:32

Visual Studio complains: Warning 1 The designer must create an instance of type \'RentalEase.CustomBindingNavForm\' but it cannot because the type is declared as abst

3条回答
  •  醉梦人生
    2021-02-03 20:18

    I haven't seen the content at urban potato (its down) but Me and Smelch came up with a solution. Form itself inherits from an abstract class, so what they dont tell you is that its only the 1st level of inheritance that can't be abstract, the 2nd on down can.

    From there its simply a matter of having an empty class in the middle and wrapping an #if debug around the forms declaration and you're good to go. Just be sure to release in release mode and design in debug mode (which is very typical).

    You'll get full designer support and a real abstract base class at design (debug) and build (release) time because each time it ends up using your abstract base class.

    The full explanation and answer is here

提交回复
热议问题