how do i use a dll ?

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

    #1

    how do i use a dll ?

    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.


    --
    Regards,

    Nathan


  • =?Utf-8?B?ZG90TmV0RGF2ZQ==?=

    #2
    RE: how do i use a dll ?

    Just add it as a reference to your project.

    =============== =============== ========
    David McCarter [Microsoft VB.NET MVP]

    VSDN Tips & Tricks .NET Coding Standards available at:
    www.cafepress.com/vsdntips.20412485


    "Nathan" wrote:
    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.
    >
    >
    --
    Regards,
    >
    Nathan
    >
    >
    >

    Comment

    • Nathan

      #3
      Re: how do i use a dll ?

      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 " <dotNetDave@dis cussions.micros oft.comwrote in message
      news:082409ED-54AB-4793-A552-718272370C39@mi crosoft.com...
      Just add it as a reference to your project.
      >
      =============== =============== ========
      David McCarter [Microsoft VB.NET MVP]

      VSDN Tips & Tricks .NET Coding Standards available at:
      www.cafepress.com/vsdntips.20412485
      >
      >
      "Nathan" wrote:
      >
      >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.
      >>
      >>
      >--
      >Regards,
      >>
      >Nathan
      >>
      >>
      >>

      Comment

      • =?Utf-8?B?RmFtaWx5IFRyZWUgTWlrZQ==?=

        #4
        Re: how do i use a dll ?

        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" wrote:
        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 " <dotNetDave@dis cussions.micros oft.comwrote in message
        news:082409ED-54AB-4793-A552-718272370C39@mi crosoft.com...
        Just add it as a reference to your project.

        =============== =============== ========
        David McCarter [Microsoft VB.NET MVP]

        VSDN Tips & Tricks .NET Coding Standards available at:
        www.cafepress.com/vsdntips.20412485


        "Nathan" wrote:
        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.
        >
        >
        --
        Regards,
        >
        Nathan
        >
        >
        >
        >
        >
        >

        Comment

        • Nathan

          #5
          Re: how do i use a dll ?

          Sweet that did the trick.

          thanx mate


          "Family Tree Mike" <FamilyTreeMike @discussions.mi crosoft.comwrot e in
          message news:94C451A2-A746-4194-927E-4F45E0CF5658@mi crosoft.com...
          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" wrote:
          >
          >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 " <dotNetDave@dis cussions.micros oft.comwrote in message
          >news:082409E D-54AB-4793-A552-718272370C39@mi crosoft.com...
          Just add it as a reference to your project.
          >
          =============== =============== ========
          David McCarter [Microsoft VB.NET MVP]

          VSDN Tips & Tricks .NET Coding Standards available at:
          www.cafepress.com/vsdntips.20412485
          >
          >
          "Nathan" wrote:
          >
          >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.
          >>
          >>
          >--
          >Regards,
          >>
          >Nathan
          >>
          >>
          >>
          >>
          >>
          >>

          Comment

          • Phill W.

            #6
            Re: how do i use a dll ?

            Nathan wrote:
            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.

            Comment

            Working...