create new control from errorProvider

295 Views Asked by At

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?

2

There are 2 best solutions below

0
On BEST ANSWER

You could encapsulate the ErrorProvider within your new control.

1
On

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.