By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,515 Members | 1,110 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,515 IT Pros & Developers. It's quick & easy.

How to invoke the ClassLibrary?

P: n/a
yxq
Hello,
I writed some classes(but not a class) in a ClassLibrary and builded a
test.dll file, but how to invoke the test.dll?

'test.dll//////////////////////

Moudle MyTest
Public class A
...
End Class

Public class B
...
End Class

Public class C
...
End Class
End Module

I have referenced the test.dll in my new project, but do not know how to use
Class A, B, C.

Thank you
Apr 4 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"yxq" <ga***@163.net> schrieb:
I writed some classes(but not a class) in a ClassLibrary and builded a
test.dll file, but how to invoke the test.dll?

'test.dll//////////////////////

Moudle MyTest
Public class A
...
End Class

Public class B
...
End Class

Public class C
...
End Class
End Module

I have referenced the test.dll in my new project, but do not know how to
use Class A, B, C.


Remove the 'Module' declaration around the classes and simply use the
classes as you would do with classes which are part of other libraries:

\\\
Imports ClassLibrary1 ' Importing the DLL's namespace.
....
Dim c As New C()
....
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Apr 4 '06 #2

P: n/a
If you've referenced the dll for the class library, then just add the Imports
statement to the module or class in which you want to use the library
classes. Then:

dim myClass as New Class A, etc.

However, unless your classes in the Class Library are really tested and
won't need and changes, the easiest way is to add the Class Library project
to your solution in which you will use the Class Library. That way, you can
easily change any of the classes in the class library and/or add to it
quickly within your solution.
--
Dennis in Houston
"yxq" wrote:
Hello,
I writed some classes(but not a class) in a ClassLibrary and builded a
test.dll file, but how to invoke the test.dll?

'test.dll//////////////////////

Moudle MyTest
Public class A
...
End Class

Public class B
...
End Class

Public class C
...
End Class
End Module

I have referenced the test.dll in my new project, but do not know how to use
Class A, B, C.

Thank you

Apr 4 '06 #3

P: n/a
Add the dll to the project references. You may also need to add the class's
namespace to the 'imports' in your project.

Reference methods from your classes by instantiating them first:

Dim aclass As A = New A

then call methods/properties from the instance:

aclass.myProperty = "something"
aclass.myMethod()

You should be able to bring it together fairly easily - if you can't then
see here:

http://msdn.microsoft.com/vstudio/express/vb/learning/
Troy
"yxq" <ga***@163.net> wrote in message
news:ep****************@TK2MSFTNGP02.phx.gbl...
Hello,
I writed some classes(but not a class) in a ClassLibrary and builded a
test.dll file, but how to invoke the test.dll?

'test.dll//////////////////////

Moudle MyTest
Public class A
...
End Class

Public class B
...
End Class

Public class C
...
End Class
End Module

I have referenced the test.dll in my new project, but do not know how to
use Class A, B, C.

Thank you

Apr 4 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.