T
tony
Hello!
Assume I have three window forms called Frm1, Frm2 and Frm3 each of these
have a method called foo1 and foo2.
Now instead of having this foo1 and foo2 in each of the three window forms I
want to put these foo1 and foo2 in the Base class and then
inherit from this class.
I did the following:
Create a class called Top where I put method foo1 and foo2 then inerit from
Top see below.
When I do this and then try to use forms designer for window form Frm1 I get
into trouble.
I get this error "An error occurred while loading the document. Fix the
error, and then try loading the document again.
The error message follows: The designer could not be shown for this file
because none of the classes within it
can be designed. The designer inspected classes in the file: Frm1 --- The
base class 'Top' could not be loaded.
Ensure the assembly has been referenced or built if it is part of the
project."
So a questiuon is must all window form inherit directly from the Form class?
So if all window form must inherit directly from the Form class how do I
solve my problem
where I want to put some methods in the Base class?
Is the solution that I must keep each method in each window form perhaps as
I had from the beginning.
public class Top : System.Windows.Forms.Form
{
public void foo1()
{}
public void foo2()
{ }
}
public class Frm1 : Top
{
}
//Tony
Assume I have three window forms called Frm1, Frm2 and Frm3 each of these
have a method called foo1 and foo2.
Now instead of having this foo1 and foo2 in each of the three window forms I
want to put these foo1 and foo2 in the Base class and then
inherit from this class.
I did the following:
Create a class called Top where I put method foo1 and foo2 then inerit from
Top see below.
When I do this and then try to use forms designer for window form Frm1 I get
into trouble.
I get this error "An error occurred while loading the document. Fix the
error, and then try loading the document again.
The error message follows: The designer could not be shown for this file
because none of the classes within it
can be designed. The designer inspected classes in the file: Frm1 --- The
base class 'Top' could not be loaded.
Ensure the assembly has been referenced or built if it is part of the
project."
So a questiuon is must all window form inherit directly from the Form class?
So if all window form must inherit directly from the Form class how do I
solve my problem
where I want to put some methods in the Base class?
Is the solution that I must keep each method in each window form perhaps as
I had from the beginning.
public class Top : System.Windows.Forms.Form
{
public void foo1()
{}
public void foo2()
{ }
}
public class Frm1 : Top
{
}
//Tony