aspatz

hello,
i have a basic "BasicPluggableForm" form and some inherited forms from this basic form.

BasicPluggableForm
BasicLayoutForm
ConcreteForm

I want to do some basic initialization "BasicInitialization()" in the basic form, but i need the params object from the Concrete Ctor "public ConcreteForm(params object[] args)" in the "ConcreteForm" for this "BasicInitialization(params)".

What can i do to capsulate this code in the BasicPluggableForm.
Thanks Arnold


Re: Windows Forms General ISupportInitialize Initial Work

nobugz

You could add this method to BasicPluggableForm:

protected virtual void Initialize(params object[] args) {
// Do your stuff...
}

Then you can override the method in derived forms (call base.Initialize()) and call it directly from the ConcreteForm constructor.





Re: Windows Forms General ISupportInitialize Initial Work

aspatz

thank you for your answer.
I did it in this way before, but i wanted to uncage the one how was implementing concrete forms from always adding this to the ctor. Therefore i thougt about another possibility. Something like implementing ISupportInitialize and do the stuff in the EndInit but this does not work.