In C# WinForms, is it possible to create an abstract User Control and derive other children from it? If yes, it is possible to accomplish it during design-time?
I would like to use a base User Control with a ListBox inside it and then reuse that ListBox for all other new User Controls I create.
The reason I would like to do this is of course the polymatic aspect of it. For example:
private void SomeMethod(UserControl_Base uc)
{
//some logic
uc.my_listBox.Name = "some name"; // a derived User Control would actually be passed.
//more logic
}
Yes.
However, the designer cannot operate on controls that inherit an abstract class. (since the design surface is actually an instance of the base class)
Either use an interface or make the base class non-abstract.