Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inheritance from TextBoxBase

Tags:

c#

winforms

I'm working on a library (.dll) file, and I want to create a little custom TextBox called FatherTextBox, so I started by deriving from TextBoxBase (an abstract class).

After coding the custom logic, I noticed that I get this error message:

The type 'System.Windows.Forms.TextBoxBase' has no constructors defined

So I guess this is not a option:

    public FatherTextBox() : base()
    {

    }

My questions are:

  1. What is the way to inherit from an abstract class without a constructor?
  2. Why doesn't TextBoxBase have a constructor?
like image 648
samy Avatar asked Dec 10 '25 15:12

samy


1 Answers

From MSDN:

You do not typically inherit from TextBoxBase. To create your own text control class, inherit from TextBox or RichTextBox.

TextBoxBase has an internal constructor, which is why you can't call it.


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!