By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,194 Members | 1,482 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,194 IT Pros & Developers. It's quick & easy.

Windows form as an abstract class?

P: n/a
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!
May 10 '06 #1
Share this Question
Share on Google+
8 Replies


P: n/a
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.

May 10 '06 #2

P: n/a
Thanks for the response Bruce, can you offer an alternative approach?

"Bruce Wood" wrote:
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.

May 11 '06 #3

P: n/a

with examples please

DB

"di****@newsgroup.nospam" <di****@newsgroup.nospam.donotspam> wrote in
message news:4C**********************************@microsof t.com...
Thanks for the response Bruce, can you offer an alternative approach?

"Bruce Wood" wrote:
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.

May 11 '06 #4

P: n/a
If using VS2005, check out Master forms.
If its only the GUI that is similar, this may be perfect for you.

May 11 '06 #5

P: n/a
Steven Nagy wrote:
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
May 11 '06 #6

P: n/a
My bad, I should read the original question with my glasses on....

May 18 '06 #7

P: n/a
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....
"John B" <jb******@yahoo.com> wrote in message
news:44********@news.iprimus.com.au...
Steven Nagy wrote:
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

May 26 '06 #8

P: n/a
Add to that generic forms... same story... same result...

Marc
May 26 '06 #9

This discussion thread is closed

Replies have been disabled for this discussion.