Home All Groups Group Topic Archive Search About

Inherited Forms in VB.NET class code does not show 'inherits from...'

Author
11 Sep 2006 12:58 PM
jandhondt
In VS2005 with VB.NET when a form or usercontrol is inherited: it is
terribly annoying that the code view shows as Public Class statement
without the inherits statement.

You have to go to the myform.designer.vb code to show this inheritance.

Also it is unclear to me where to put an overloaded New(...)
definition: in the partial class where you'd type all your other code,
or in the myform.designer.vb code ?

Jan D'Hondt
Database development in .NET
DotNetNuke development

Author
11 Sep 2006 1:20 PM
Patrice
The designer file is there to isolate designer generated code from your own
code. Keep your own code inside the myform.vb class...

For the first point, I don't really have anyway to solve this. Perhaps using
a naming convention or a specific folder for Forms ? You could add this as a
comment (or perhaps as a statement but I don't know how the compiler will
react)...


--
Patrice

"jandhondt" <jandho***@jadesoft.be> a écrit dans le message de news:
1157979495.263749.131***@h48g2000cwc.googlegroups.com...
Show quoteHide quote
> In VS2005 with VB.NET when a form or usercontrol is inherited: it is
> terribly annoying that the code view shows as Public Class statement
> without the inherits statement.
>
> You have to go to the myform.designer.vb code to show this inheritance.
>
> Also it is unclear to me where to put an overloaded New(...)
> definition: in the partial class where you'd type all your other code,
> or in the myform.designer.vb code ?
>
> Jan D'Hondt
> Database development in .NET
> DotNetNuke development
>
Author
11 Sep 2006 2:02 PM
Robinson
"jandhondt" <jandho***@jadesoft.be> wrote in message
news:1157979495.263749.131830@h48g2000cwc.googlegroups.com...
> In VS2005 with VB.NET when a form or usercontrol is inherited: it is
> terribly annoying that the code view shows as Public Class statement
> without the inherits statement.
>
> You have to go to the myform.designer.vb code to show this inheritance.

I have to agree to with this.  I have solved it to an extent as Patrice says
by having a folder structure that reflects inheritance in my solution.
Author
11 Sep 2006 2:52 PM
jandhondt
Tnx for the replies.

One big reason for me to switch from the old VB6 to VB.NET was the fact
that all the code for a form was in 1 file and it was all code, which
gave us a lot more control over all the controls in a form compared to
the hidden and unreachable code behind VB6 forms. als great for
applying inheritance and so forth.
Then came VB.2005 and they started to give up the principle of having
everything in one file and moved to more hidden files again. There's a
an american saying : "If it ain't broken, don't fix it". If only they
could appreciate this a bit more at Microsoft.
BTW they did add a lot of good things too, but if only they could keep
their hands off of things that worked.

Robinson schreef:

Show quoteHide quote
> "jandhondt" <jandho***@jadesoft.be> wrote in message
> news:1157979495.263749.131830@h48g2000cwc.googlegroups.com...
> > In VS2005 with VB.NET when a form or usercontrol is inherited: it is
> > terribly annoying that the code view shows as Public Class statement
> > without the inherits statement.
> >
> > You have to go to the myform.designer.vb code to show this inheritance.
>
> I have to agree to with this.  I have solved it to an extent as Patrice says
> by having a folder structure that reflects inheritance in my solution.
Author
11 Sep 2006 3:06 PM
Robinson
Show quote Hide quote
"jandhondt" <jandho***@jadesoft.be> wrote in message
news:1157986372.262178.198350@d34g2000cwd.googlegroups.com...
> Tnx for the replies.
>
> One big reason for me to switch from the old VB6 to VB.NET was the fact
> that all the code for a form was in 1 file and it was all code, which
> gave us a lot more control over all the controls in a form compared to
> the hidden and unreachable code behind VB6 forms. als great for
> applying inheritance and so forth.
> Then came VB.2005 and they started to give up the principle of having
> everything in one file and moved to more hidden files again. There's a
> an american saying : "If it ain't broken, don't fix it". If only they
> could appreciate this a bit more at Microsoft.
> BTW they did add a lot of good things too, but if only they could keep
> their hands off of things that worked.

Ah well to be honest, I mostly prefer not having the code cluttering up my
main source file, especially as it's designer generated.  There are certain
important things I would like to see in the user source file though -
inheritance is one of them and also the constructor.  However the latter
appears as soon as you write Public Sub New and press enter so it's no
biggie.  Overall I think 2005 (and .NET 2.0)  are a huge improvement over
what came before.
Author
11 Sep 2006 2:54 PM
Patrice
I gave a try at the other option and it works. You are allowed to duplicate
the inherits statement used in myfile.designer.vb in the myfile.vb file. The
compiler will report an error only if you you don't inherit from the same
class in those two files...

--
Patrice

"Robinson" <itoldyounottospamme@nowmyinboxisfull.com> a écrit dans le
message de news: ee3qah$qu1$1$830fa***@news.demon.co.uk...
Show quoteHide quote
> "jandhondt" <jandho***@jadesoft.be> wrote in message
> news:1157979495.263749.131830@h48g2000cwc.googlegroups.com...
>> In VS2005 with VB.NET when a form or usercontrol is inherited: it is
>> terribly annoying that the code view shows as Public Class statement
>> without the inherits statement.
>>
>> You have to go to the myform.designer.vb code to show this inheritance.
>
> I have to agree to with this.  I have solved it to an extent as Patrice
> says by having a folder structure that reflects inheritance in my
> solution.
>