Interface creation in VB.Net 2005

G

Guest

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?
 
H

Herfried K. Wagner [MVP]

John Mason said:
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...'.
 
G

Guest

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top