create new control from errorProvider
-
11-02-2021 - |
题
I want to create a control MessageProvider
just like ErrorProvider
..what I did is, created a class and inherited from ErrorProvider..
But now problem is, instead of SetError
and GetError
methods, I want to have SetMessage
and GetMessage
..and those SetError
and GetError
methods should not be part of MessageProvider class..
How can I create a new control MessageProvider
?
解决方案
You could encapsulate the ErrorProvider within your new control.
其他提示
You cannot hide public methods from an inherited class as there is no private inheritance in the CTS. You can, however, easily add the SetMessage() and GetMessage() methods to your derived class and implement the desired functionality.
Your other option is to roll your own MessageProvider class that implements (mimics) only the desired functionality of ErrorProvider. This is probably more trouble than it's worth. I'd just derive and live with all the inherited functionality.