2
I am trying to create a component that inherits from a Combox. I created the component by following the steps below, the project is available at: https://dl.dropboxusercontent.com/u/74275347/ComponentesProprios.rar
- No open project >File > New > Project > Class Library (Visual C#) > Name: "Components"
- Delete Class1.Cs
- In the project "Right click" > Add... > Component > Component Class (Visual C# Items) > Name: "Comboboxex"
- In References > Add Reference... > Search for "Forms > Mark System.Windows.Forms > OK
- In the "code" change
Component
forComboBox
> addusing System.Windows.Forms;
> inpublic ComboBoxEx()
underInitializeComponent();
addDropDownStyle = ComboBoxStyle.DropDownList;
- Save and "build"
- In a Windowsformsapplication project I right click on a tab of "Tollbox" > Choose Items... > in the tab. NET Framework Components > click on Browse.. > I select "C: C# branches Repository Componentssums bin Debug Componentssums.dll"
This is when the message and error "There are no Components in 'C: C# Programming branches Repositorio Componentesproprios Componentesproprios bin Debug Componentesproprios.dll' appears that can be placed on the Toolbox."
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);
}
}
}
There is a real need to develop the component in a dll the part?
– Jéf Bueno
The need is for the same component to be available for multiple projects
– Benjamim Mendes Junior
Benjamin, erase the class
.designer
which was created automatically and tries again.– Jéf Bueno
I erased but the mistake was necessary
– Benjamim Mendes Junior
Did you recompile to create a new dll? I just tested it here and it worked
– Jéf Bueno
Yes, if you can send me the project. I even tried to delete the bin folder,
– Benjamim Mendes Junior
Dude, put the code where you create the components
– Jéf Bueno
Let’s go continue this discussion in chat.
– Benjamim Mendes Junior