component interface

solaar

Member
Joined
Jun 1, 2006
Messages
8
Programming Experience
1-3
Hi

I am new to Visual Studio.net and am building components using VB.net, I have followed this article: - http://www.vbdotnetheaven.com/code/apr2003/019.asp

I now want to build interfaces for my components which I have the code for but don't know what project template to use, should i use a blank template? If so what should i save the interface as and where. Like I said i'm new to all this, the coding seems straightforward but piecing it all together seems to be the tricky part.

Regards

Solaar
 
Last edited:
Maybe i'm being a bit of a dope here, but i don't really understand what you are asking when you say you want to save the interface? Could you explain in a bit more detail.
 
It's me being the dope for certain. I want to use my interface code but i don't know where to put it, the article i referred to shows how to create a component using vb.net but not how to create an interface. I just want to know the procedure for creating an interface.
 
Ok, i've read that article again and i still havent a clue what your asking, an interface can mean a couple of things in vb.net i assume you mean Graphical user interface? If so what type of component are you trying to create and what sort of interface do you want to create?
 
component interfaces

Hi , I have posted a similar, poorly described question in the VS forum but i think it was the wrong place so i hope this isn't spamming, apologies if it is construed as such.

Anyway I have used visual studio to create VB.NET component by using the Class Library Project Template, adding methods and then building a DLL. I now want to create an interface for the component but am not sure what to do, i suspect that i use a blank project template but am not confident. The code for the component and interface are pasted below, i've borrowed this from a tutorial.

Regards

Solaar

VB.NET:
'Interface code... 
Public Interface Test 
'creating an Interface named Test 
Sub disp() 
Function Multiply() As Double 
'specifying two methods in an interface 
End Interface 
 
'component code... 
Public Class One 
&nbspImplements Test 
'implementing interface in class One 
 
Public i As Double = 12 
Public j As Double = 12.17 
 
Sub disp() Implements Test.disp 
'implementing the method specified in interface 
WriteLine("sum of i+j is" & i + j) 
Read() 
End Sub 
 
Public Function multiply() As Double Implements Test.Multiply 
'implementing the method specified in interface 
WriteLine(i * j) 
Read() 
End Function
 
Last edited by a moderator:
You only use interfaces when you need to handle several different classes as a common type or when creating COM libraries (libraries that operate outside .Net managed world). It doesn't sound to me as this is what you seek.

As to where/what project to put an interface, since you specifically asked, you can put this anywhere as long as its accessible to those that need to use it (classes implementing it and classes accessing other class instances through an interface), commonly declared Public outside a class or in a module.

The code in your last link is a Console Application project (and an awfully bad example of using interfaces). Your first link explains clearly that they create a Class Library project, then create a Console Application project that references and use that library (and no interfaces as you see).
 
Back
Top