Constructor of type "Track_Attack.TAGeneric" not found. C # winforms

I get a warning in Visual Studio 2010 (the one in the header)

Basically, I created a general form that contains many variables, virtual functions.

It takes a class, which I made as a parameter, and assigns it to a local variable (which is then set as the simplest using getters and setters)

Then I made another form that inherits from this form. Everything is fine, it works, but when I try to look at its constructor, I get this error message.

public TAGeneric(TAManager iManager) { ControlHelper.SuspendDrawing(this); mManager = iManager; SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true); InitializeComponent(); SetupCommandBar(); ControlHelper.ResumeDrawing(this); } 

This is the parent.

  public TAAddInterval(TAManager iManager) : base(iManager) { InitializeComponent(); } 

This is a child. Forget that I use the "manager" when he is disapproving. Has anyone clarified the problem? Literally works fine, but when it comes to editing the graphic side in the designer, it won't load it.

Thanks for the help.

+4
source share
2 answers

I suspect you need to provide a parameterless constructor for the designer:

 public TAAddInterval(TAManager iManager) : base(iManager) { InitializeComponent(); } [Obsolete("This constructor only exists for the benefit of the designer...")] public TAAddInterval() : this(null) { } 

If you have some fake TAManager that you could provide instead, this could lead to a NullReferenceException being thrown if the developer succeeds in using code that uses the dispatcher.

+8
source

Probably you just need a constructor without parameters, and the designer will work fine.

+2
source

Source: https://habr.com/ru/post/1434843/


All Articles