how do i use a dll ?

N

Nathan

Hi, i'm kinda new to vb.net 2005

I have a bunch of functions i would like to share with other vb.net apps
i've created.
i've managed to create a class library project and put all my functions in
there and then built the project and now i have a dll file in the /bin/debug
dir.

How do i access its functions in another vb.net project???

I know this is pretty basic, i just havn't figured it out yet.
 
N

Nathan

thanx,

i did that. even did Imports Library.Class1
i have a function called LogError. how do i call it? When i try typing just
LogError there's no intelisense and it errors.


nathan


dotNetDave said:
Just add it as a reference to your project.

======================================
David McCarter [Microsoft VB.NET MVP]
www.vsdntips.com
VSDN Tips & Tricks .NET Coding Standards available at:
www.cafepress.com/vsdntips.20412485


Nathan said:
Hi, i'm kinda new to vb.net 2005

I have a bunch of functions i would like to share with other vb.net apps
i've created.
i've managed to create a class library project and put all my functions
in
there and then built the project and now i have a dll file in the
/bin/debug
dir.

How do i access its functions in another vb.net project???

I know this is pretty basic, i just havn't figured it out yet.
 
G

Guest

If the function in Class1 was tagged with "shared", then this should work, so
it sounds like it wasn't. This means you need an instance of the Class1
object, as follows:

dim obj as new Class1
obj.LogError()


Nathan said:
thanx,

i did that. even did Imports Library.Class1
i have a function called LogError. how do i call it? When i try typing just
LogError there's no intelisense and it errors.


nathan


dotNetDave said:
Just add it as a reference to your project.

======================================
David McCarter [Microsoft VB.NET MVP]
www.vsdntips.com
VSDN Tips & Tricks .NET Coding Standards available at:
www.cafepress.com/vsdntips.20412485


Nathan said:
Hi, i'm kinda new to vb.net 2005

I have a bunch of functions i would like to share with other vb.net apps
i've created.
i've managed to create a class library project and put all my functions
in
there and then built the project and now i have a dll file in the
/bin/debug
dir.

How do i access its functions in another vb.net project???

I know this is pretty basic, i just havn't figured it out yet.
 
N

Nathan

Sweet that did the trick.

thanx mate


Family Tree Mike said:
If the function in Class1 was tagged with "shared", then this should work,
so
it sounds like it wasn't. This means you need an instance of the Class1
object, as follows:

dim obj as new Class1
obj.LogError()


Nathan said:
thanx,

i did that. even did Imports Library.Class1
i have a function called LogError. how do i call it? When i try typing
just
LogError there's no intelisense and it errors.


nathan


dotNetDave said:
Just add it as a reference to your project.

======================================
David McCarter [Microsoft VB.NET MVP]
www.vsdntips.com
VSDN Tips & Tricks .NET Coding Standards available at:
www.cafepress.com/vsdntips.20412485


:

Hi, i'm kinda new to vb.net 2005

I have a bunch of functions i would like to share with other vb.net
apps
i've created.
i've managed to create a class library project and put all my
functions
in
there and then built the project and now i have a dll file in the
/bin/debug
dir.

How do i access its functions in another vb.net project???

I know this is pretty basic, i just havn't figured it out yet.
 
P

Phill W.

Nathan said:
I have a bunch of functions i would like to share with other vb.net apps
i've created.
i've managed to create a class library project and put all my functions in
there and then built the project and now i have a dll file in the /bin/debug
dir.

How do i access its functions in another vb.net project???

Two ways:

(1) Reference the dll from your "other" project.
This will take a local copy of the dll that has to be distributed along
with your calling application (.exe + local .dll).

(2) Strongly Name the dll and add it to the Global Assembly Cache (GAC).
Reference the dll from where you compiled it - this time, it /won't/
take a local copy of it. Shipping your application now consists of the
..exe and the .dll, which has to be added to the GAC on the target
machine, but your installer, whichever you choose, should take care of
that for you.

IMHO, This is the better way to reuse code in /lots/ of applications -
there's only one copy of the dll on the machine and any application
/anywhere/ on the machine can find it. It /does/ take a little more
doing but, personally, I prefer it to having lots of potentially
different copies of the [same] dll each shipped with a different
application. YMMV.

HTH,
Phill W.
 

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