We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

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

yaronusa
yaronusa asked
on
Medium Priority
590 Views
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?

Thanks!
Comment
Watch Question

Anurag ThakurTechnical Manager
Commented:
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

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
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.
Anurag ThakurTechnical Manager
Commented:
System.Windows.Forms (in System.Windows.Forms.dll)

Author

Commented:
Alright...
 
 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?
Commented:
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.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.