all groups > dotnet windows forms designtime > february 2006 >
You're in the

dotnet windows forms designtime

group:

inheriting a form with special constructor


inheriting a form with special constructor msnews.microsoft.com
2/2/2006 9:35:23 PM
dotnet windows forms designtime: Hi,

I created a base form, what holds several graphical elements (text boxes,
etc). This form has only one constructor, what expects one integer
parameter. Call this BaseForm
It's constructor looks like:
public BaseForm(int Param1)
{
InitializeComponent();
}
Now I inherit a second form from this one (Call this InheritedForm), and I
found out, that I have to define the constructor as follows:
public InheritedForm(int Param1):base (Param1)
{
InitializeComponent();
}
Now, my problem is, that in the designer the form can not be shown, since
there is an error:
Construcotr on type 'WindowsApplication1.BaseForm' not found.

Why? I defined the constructor! Moreover, if I create a second "default"
conrtuctor:
public BaseForm()
{
InitializeComponent();
}
is not helping at all.

How can I see in the designer the InheritedForm? How can I add more visual
components on it? What did I wrong?

Thanks:

Peter

Re: inheriting a form with special constructor jokiz
2/7/2006 4:00:48 AM
winform designer's behavior in reproducing forms at design time is
instantiate base class, then execute InitializeComponent method.

you should be going with the parameterless constructor for forms. what
do you want to accomplish with the integer parameter?

--------------
community.devpinoy.org
AddThis Social Bookmark Button