Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Adding class libary

Adding class libary

Scheduled Pinned Locked Moved Visual Basic
question
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cstrader232
    wrote on last edited by
    #1

    Sorry for what must be a very basic question, but here goes: My main project is getting too big, so I want to move some of my classes to a class library Once I do that, however, the classes can no longer find the classes in my main project What's the solution? I can see that it could be possible to reference the main .exe from the .dll but doing so seems odd to me because the main .exe also references the .dll. Thanks

    T A 2 Replies Last reply
    0
    • C cstrader232

      Sorry for what must be a very basic question, but here goes: My main project is getting too big, so I want to move some of my classes to a class library Once I do that, however, the classes can no longer find the classes in my main project What's the solution? I can see that it could be possible to reference the main .exe from the .dll but doing so seems odd to me because the main .exe also references the .dll. Thanks

      T Offline
      T Offline
      The Man from U N C L E
      wrote on last edited by
      #2

      Referencing both ways can be done, but not in one solution. However this would just indicate your design is wrong. Classes in your class library should be used by the main app classes and not reference them. If you have to reference them then either move more classes to the class library or move them back into the main app. As to getting too big, we have projects containing hundreds of classes, which is fine when they are organised in a decent folder structure. I have heard of projects that extend to thousands of classes and take up to an hour to build without problems.

      If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) www.JacksonSoft.co.uk

      1 Reply Last reply
      0
      • C cstrader232

        Sorry for what must be a very basic question, but here goes: My main project is getting too big, so I want to move some of my classes to a class library Once I do that, however, the classes can no longer find the classes in my main project What's the solution? I can see that it could be possible to reference the main .exe from the .dll but doing so seems odd to me because the main .exe also references the .dll. Thanks

        A Offline
        A Offline
        Abhishek Sur
        wrote on last edited by
        #3

        Create a class Library... Produce a Dll and then Reference it. This might be the simplest. But do you think all the units by this way may have produced a unseparable block. The main motive of making external class libraries and compile as dll is to create independent module. I recommend you to refactor each classes to produce independent modules and then reference it. I think the compiler is intellegent enough to load the dll when required. I wrote a fine article to demonstrate how dependency between modules might kill your performance. Check it out. Simplify Code Using NDepend[^] So as suggested, To separate classes is not what you are making. If you just want to separate classes, make a folder place them.. and you might call them using a namespace. But if separation is really required, you need to find out classes that are actually independent of other modules(Such as utility classes). Hope you understand. Cheers.. :rose:

        Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


        My Latest Articles-->** Simplify Code Using NDepend
        Basics of Bing Search API using .NET
        Microsoft Bing MAP using Javascript

        L 1 Reply Last reply
        0
        • A Abhishek Sur

          Create a class Library... Produce a Dll and then Reference it. This might be the simplest. But do you think all the units by this way may have produced a unseparable block. The main motive of making external class libraries and compile as dll is to create independent module. I recommend you to refactor each classes to produce independent modules and then reference it. I think the compiler is intellegent enough to load the dll when required. I wrote a fine article to demonstrate how dependency between modules might kill your performance. Check it out. Simplify Code Using NDepend[^] So as suggested, To separate classes is not what you are making. If you just want to separate classes, make a folder place them.. and you might call them using a namespace. But if separation is really required, you need to find out classes that are actually independent of other modules(Such as utility classes). Hope you understand. Cheers.. :rose:

          Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


          My Latest Articles-->** Simplify Code Using NDepend
          Basics of Bing Search API using .NET
          Microsoft Bing MAP using Javascript

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          A small correction, assemblies are loaded by the Runtime, not by the compilers.

          C 1 Reply Last reply
          0
          • L Lost User

            A small correction, assemblies are loaded by the Runtime, not by the compilers.

            C Offline
            C Offline
            cstrader232
            wrote on last edited by
            #5

            Thanks for your comments... This is not an organizational problem but a performance one. I figured my program would load faster if some of the classes were in a separate dll. But perhaps that is not true (didn't test it yet)

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups