Error in C # when trying to add an inherited component in ToolBox

2

I'm trying to create a component that inherits from a ComBox. I created the component by following the steps below, the project is available at: link

  • Without any open project > File > New > Project > Class Library (Visual C #) > Name: "Custom Components"
  • Delete Class1.cs
  • In the "Right click" project > Add ... > Component > Component Class (Visual C # Items) > Name: "ComboBoxEx"
  • In References > Add Reference ... > Search for "Forms > Check System.Windows.Forms & OK"
  • In the "code" change Component by ComboBox > add% with% > in using System.Windows.Forms; under public ComboBoxEx() add InitializeComponent();
  • Save and "build"
  • In a WindowsFormsApplication project I right click on a tab of the "TollBox" > Choose Items ... > on the .NET Framework Components > I click Browse .. > I select "C: \ Program Files \ C # \ branches \ Repository \ HomeProducts \ Common Components \ bin \ Debug \ ComponentsProprios.dll"

This is when the message and error "There are no components in 'C: \ Programmer \ C # \ branches \ Repository \ Components \ OwnProfile \ bin \ Debug \ ComponentsProprios.dll' that is placed on the toolbox. / p>

BomboBoxEx class     using System;     using System.Collections.Generic;     using System.ComponentModel;     using System.Diagnostics;     using System.Linq;     using System.Text;     using System.Windows.Forms;

namespace ComponentesProprios
{
    public partial class ComboBoxEx : ComboBox
    {
        public ComboBoxEx()
        {
            DropDownStyle = ComboBoxStyle.DropDownList;
        }

        public ComboBoxEx(IContainer container)
        {
            container.Add(this);
        }
    }
}
    
asked by anonymous 21.07.2015 / 22:40

2 answers

2

According to some of the answers that I saw in SOen the problem may be in Visual Studio itself and there are two things that have to be done to try to solve the problem. >

  • Right-click the toolbox and then click Reset toolbox
  • Instead of clicking choose items , try dragging the dll into the toolbox
  • 22.07.2015 / 04:04
    0

    Make sure that the version of .NET that made the components is compatible with the version of the project where you want to use them.

    For example, do not create a component in .NET 4.5 and try to use it in a .NET 3.5 application.

        
    22.07.2015 / 01:14