从基本UserControl继承

时间:2014-04-24 08:40:59

标签: vb.net inheritance user-controls

我有几个具有类似功能的user controls,因此我考虑将所有这些方法移至BaseUserControl class,并使所有user controls继承自它。

然而,当我这样做时,我得到了这个compliler警告:

Base class BaseUserControl  specified for class UserControl1 cannot be different from the base class System.Windows.Forms.UserControl of one of its other partial types

我知道我收到此警告是因为当我创建BaseUserControl时,其设计器中的自动生成代码会向System.Windows.Forms.UserControl添加继承。

所以,

 1. how can I inherit from an `UserControl` in `VB.NET`?

 2.Is it possible? If not, how could I avoid code repetition in my case?

谢谢!

0 个答案:

没有答案