'Failed to load toolbox item. It will be removed from the toolbox , what is a ways to solve it?
An issue I faced is - I have the custom UserControl which I would like to add to my TabControl as an additional tab, so to make it I just found my UserControl in the toolbox and pulled it to my TabControl and immediately I get an error popup which says
Failed to load toolbox item. It will be removed from the toolbox
After research, I found a few answers like these
https://stackoverflow.com/a/44628024/5709159
and this one
They are talking about the mismatch between 32 and 64-bit processing, but I really can't get the idea about how to fix it? Like where I need to click or what I need to recompile to make it work? If someone could translate me what is written at those links to the more clear language I'll appreciate it.
EDIT
I am trying to add a completely new UserControl, which means I create a new UserControl, and as is I open the toolbox and pull it in my tab that was created in tab control as a result I get an error above. So, there are no constructors or early access to parent issues.
Regarding CPU I don't use AnyCPU I use x64 could it be an issue? And also in order to check, I can't switch to AnyCPU because my project is not compatible with AnyCPU.
Solution 1:[1]
In your project properties, try changing the Platform target in the build tab to x86. It worked for me when I had a similar problem.
Solution 2:[2]
In my case, it was the other way round: I implemented a class derived from ElementHost as a wrapper around a WPF control, in order to be able to integrate it into Winforms. When I added the ElementHost to the form programmatically, everything went fine, but when I wanted to drag&drop it from the VS toolbox, I got the "Failed to load toolbox item" message.
The reason was that I used the x64 version of Visual Studio, which seems to require the ElementHost derived class being in an "Any CPU" assembly. So the solution was to set the assembly containing the control to "Any CPU".
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | kyle campbell |
| Solution 2 | Heinz Kessler |
