Home All Groups Group Topic Archive Search About

Interface creation in VB.Net 2005

Author
15 Feb 2006 10:41 PM
John Mason
Is it me or has the way interfaces created changed in VB 2005?
I have to create a class file and then create the Interface within that, e.g.:
to create an Interface called IOrders, I create a class file called
Interfaces then within that file:
Public Class Interfaces
    Interface IOrders
        Property myOrderID() As Integer
    End Interface
End Class

To reference this Interface in an Implements statement I have to use
Interfaces.IOrders. If I don't 'wrap' the interface in a class it can't be
seen by any Implements statement.
Am I don't something embarassingly wrong here, or have things changed with
2005?

Author
15 Feb 2006 10:46 PM
Herfried K. Wagner [MVP]
Show quote Hide quote
"John Mason" <JohnMa***@discussions.microsoft.com> schrieb:
> Is it me or has the way interfaces created changed in VB 2005?
> I have to create a class file and then create the Interface within that,
> e.g.:
> to create an Interface called IOrders, I create a class file called
> Interfaces then within that file:
> Public Class Interfaces
>    Interface IOrders
>        Property myOrderID() As Integer
>    End Interface
> End Class
>
> To reference this Interface in an Implements statement I have to use
> Interfaces.IOrders. If I don't 'wrap' the interface in a class it can't be
> seen by any Implements statement.

Mhm...  It should work without adding the interface to the class as a nested
type.  I am curious if it only doesn't show up in IntelliSense or if the
compiler complains about the 'Implements...'.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
16 Feb 2006 9:39 AM
John Mason
Many thanks for your reply Herfried, I think I have now resolved the problem.
Initially, when creating the class file which I wanted to use for my
Interface file I chose NOT to store the file in the App_Code folder. In that
resulting file, the Interface name would not show up in Intellisense.
Now, by allowing the file to be created in the App_Code folder, the
Interface IS available in Intellisense.
I'm afraid I'm a victim of trying to learn VB.Net 2005 at home, without the
crutch of my far more intelligent colleagues and the Help system showing me
everything except what I need to know!

Show quoteHide quote
"Herfried K. Wagner [MVP]" wrote:

> "John Mason" <JohnMa***@discussions.microsoft.com> schrieb:
> > Is it me or has the way interfaces created changed in VB 2005?
> > I have to create a class file and then create the Interface within that,
> > e.g.:
> > to create an Interface called IOrders, I create a class file called
> > Interfaces then within that file:
> > Public Class Interfaces
> >    Interface IOrders
> >        Property myOrderID() As Integer
> >    End Interface
> > End Class
> >
> > To reference this Interface in an Implements statement I have to use
> > Interfaces.IOrders. If I don't 'wrap' the interface in a class it can't be
> > seen by any Implements statement.
>
> Mhm...  It should work without adding the interface to the class as a nested
> type.  I am curious if it only doesn't show up in IntelliSense or if the
> compiler complains about the 'Implements...'.
>
> --
>  M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
>  V B   <URL:http://classicvb.org/petition/>
>
>