Interface creation in VB.Net 2005

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Mason

    #1

    Interface creation in VB.Net 2005

    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.IOrd ers. 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?

  • Herfried K. Wagner [MVP]

    #2
    Re: Interface creation in VB.Net 2005

    "John Mason" <JohnMason@disc ussions.microso ft.com> schrieb:[color=blue]
    > 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.IOrd ers. If I don't 'wrap' the interface in a class it can't be
    > seen by any Implements statement.[/color]

    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/>

    Comment

    • John Mason

      #3
      Re: Interface creation in VB.Net 2005

      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!

      "Herfried K. Wagner [MVP]" wrote:
      [color=blue]
      > "John Mason" <JohnMason@disc ussions.microso ft.com> schrieb:[color=green]
      > > 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.IOrd ers. If I don't 'wrap' the interface in a class it can't be
      > > seen by any Implements statement.[/color]
      >
      > 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/>
      >
      >[/color]

      Comment

      Working...