all groups > visual studio .net general > november 2006 >
You're in the

visual studio .net general

group:

vb.net forms inheritance problems



vb.net forms inheritance problems rforman61 NO[at]SPAM msn.com
11/13/2006 10:45:53 AM
visual studio .net general: I don't understand this, I am having trouble inheriting forms both in
VS.NET 2003 and 2005; in either case I have forms that won't open up in
the designer, displaying error messages that make it clear that the IDE
is trying to instantiate the base form and run its code, which I really
don't understand. The threads I've found in my research indicate that
this is caused by the base form's being defined as MustInherit, but my
base forms are not declared this way.

Can anyone tell me how to inherit and view a base form in the VS.NET
IDE, without the IDE trying to instantiate the base form and run its
code at design time?

I'm doing this all in VB.NET.

Thanks,
richforman
RE: vb.net forms inheritance problems William Sullivan
11/20/2006 8:41:02 AM
Well, you have to understand that when you open the form in the designer it
really is being instantiated. There are properties in the form you can check
to see if the form is being opened in design time or in run time. It looks
like you must have some code that's running in the constructor for the base
form that's failing under design time. I believe you can use the property
Me.DesignMode to determine if your form is being opened in a designer. Based
on this boolean, run the code that breaks in the IDE only when it returns
false.

[quoted text, click to view]
AddThis Social Bookmark Button