How to make a custom control compatible with errorProvider?
我有一个看起来像这样的 winform 自定义控件:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | Public Class MyCustomControl Inherits Control Implements INotifyPropertyChanged 'Some textboxes... private Textbox1 as textbox private Textbox2 as textbox private Textbox3 as textbox 'Control value Property Value as MyCustomClass get 'Extract some values from textboxes and return MyCustomClass (a separate custom object) end get Set(value As MyCustomClass) 'Set the values of the textboxes from the Value object end Set end Property end class |
我想将此对象插入到一个 winform 中,并且我希望我的控件与 errorProvider"兼容"。这样,如果我在表单中插入一个 errorProvider 并调用:errorProvider.SetError(MyCustomControl,"Error message"),它将根据自定义逻辑在我的自定义控件中的特定文本框中显示错误消息。
有谁知道应该实现哪个接口或如何实现?
谢谢。干杯,
使用
理想情况下,您将使用