How to convert inherited control into DLL in c# csharp .net

Posted on 2009-02-09
Last Modified: 2013-12-17
I have several inherited controls (text boxes, combo boxes) which I can drag from the tool box and drop on the form.

But I would like to make them into DLL's, so that I can use them in various future projects? How do I do that?

Question by:yaronusa
    LVL 26

    Assisted Solution

    by:Anurag Thakur
    create a class library project and add all the controls to it
    then add the reference to the project in which you want to use the controls
    if you want to add the controls to the tool box then select add remove and select the assembly and add to the toolbox and then you can drag and drop the controls to the user interface as other windows controls

    Author Comment

    So I started a class library project, and added all the files to it, but I am having a problem with the following using statement on all the inherited controls:

    using System.Windows.Forms;

    Windows is underlined, and cannot be found, even with the intellisense.

    Am I on the right track?

    What will the reference to this class library project be? The namespace of my class library is CustomTextBoxes and the project name is TextBoxes.

    Thank for your help I really appreciate it.
    LVL 26

    Assisted Solution

    by:Anurag Thakur
    System.Windows.Forms (in System.Windows.Forms.dll)

    Author Comment

     I added the reference System.Windows.Forms to the TextBoxes project and the Windows is no longer underlined.
     To compile the Class Library project, I created an executable project.
     Then I created a new Windows Application called TestDriveTextBoxes project, and I added a reference to the TextBoxes.dll that was generated. But none of my inherited controls have shown in the toolbox anywhere.
     So I went back to the TestDriveTextBoxes project and in the toolbox, under the category 'TextBoxes Components' it says "There are no usable controls in this group. Drag an item onto this text to add it to the toolbox." So I try to do that, but it can't go on there.

    Do you know why the inherited controls are not showing?

    Accepted Solution

    OK, it was a simple mistake: the access modifier to my class was not public; an inherited control that is put into a class library project for the purpose of being referenced by other projects needs its inherited classes that represent controls be publicly accessible.

    Thank you for helping me find the solution; couldn't do it without you.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    In my previous article ( we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
    More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now