Windows form as an abstract class?

G

Guest

Is it possible to create a windows form as an abstract class?

Let me explain ...

I am writing a windows applciation where I will need around 100 dialogs -
each with a similar look, feel, and functionality (or controls) - but all a
little different.

Thus, if I create a windows form as an abstract class I am thinking I can
write the 'core functionality' once and then when I implement each instance,
I can just focus on the new functionality.

Any references or advice on pursuing working with dialogs in this way? Is
there a better way that solves my issues?

Thanks!
 
B

Bruce Wood

The base class for a Form cannot be abstract and play nice with the
Designer.

That said, there is nothing stopping you from creating virtual methods
/ properties in your base Form that throw a NotImplementedException
whenever they are called, thus forcing all child Forms to implement
that method / property.

The only bummer is that it's not enforced by the compiler.
 
S

Steven Nagy

If using VS2005, check out Master forms.
If its only the GUI that is similar, this may be perfect for you.
 
J

John B

Steven said:
If using VS2005, check out Master forms.
If its only the GUI that is similar, this may be perfect for you.
Are master forms available in winform flavour?
I can see master pages in help but no master forms.

Cheers
JB
 
T

Tim Brooks

I don't believe VS2005 has added support for abstract Forms using the
Designer. I know it wasn't possible in 2003 and I was jsut searching for
the same thing myself. I think its because the Designer has to be able to
instantiate the form. Nothing stopping you from creating abstract form
class but then you'd get designer errors whenever you tried to open an
inherited that instantiated the abstract form class......

Anyone else feel free to correct. This was a feature I had hoped to see in
the 2005 designer myself....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top