Failed to create component 'AxHost' System.Runtime.InteropServices.COMException (0x80029C4A)

1

I have created .Net usercontrol in C#. it is graphical control with a text box and listbox. Now I want to use this control in legacy VC++ application.(native binary). means I want to call manage code from unmanage code.

suppose my usercontrol name is xyz.dll. I generated tlb file using tlbexp.exe and then i registered this control using below command line. regasm xyz.dll /tlb:"C:\xyz.tlb" /codebase

I have checked my control using 'Activex control test container' (open studio 2005 and go to 'tools' menu) I tested my .Net usercontrol on this tool and it worked fine.

then I created a sample C# window application. Under Toolbox, I right click and selected 'Choose Items' and selected "COM component" tab. and choose my xyz.dll control. now this contol is added into toolbox.

But when I drag this control onto window then i got below error. Failed to create component 'AxHost'. The error message follows:

'System.Runtime.InteropServices.COMException (0x80029C4A): Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)) at System.Windows.Forms.Design.DocumentDesigner.AxToolboxItem.CreateComponentsCore(IDesignerHost host) at System.Drawing.Design.ToolboxItem.CreateComponentsCore(IDesignerHost host, IDictionary defaultValues) at System.Drawing.Design.ToolboxItem.CreateComponents(IDesignerHost host, IDictionary defaultValues) at System.Windows.Forms.Design.OleDragDropHandler.CreateTool(ToolboxItem tool, Control parent, Int32 x, Int32 y, Int32 width, Int32 height, Boolean hasLocation, Boolean hasSize, ToolboxSnapDragDropEventArgs e)' .

also give me some pointer "how to use .net usercontrol into legacy C# application"

c#
.net
user-controls
asked on Stack Overflow Jul 20, 2011 by user847455 • edited Dec 14, 2013 by BenMorel

2 Answers

1

Type the following in command prompt , regsvr32 "C:\Program Files\VideoLAN\VLC\axvlc.dll" to register dll file

answered on Stack Overflow Dec 19, 2013 by user2959251 • edited Dec 19, 2013 by Saghir A. Khatri
0

There is not enough information but my guess so far:

The Control is developed in .NET 4 and the legacy C# application is in .NET 2. .NET 4 can mix .NET-version in the same process, but .NET 2 can't so I suspect to solve this you need to develop/build the control in .NET 2 so that it is usable in .NET 2 & 4.

EDIT (after the comment about .NET 3.5):

You need to register the control by running regsvr32.

EDIT 2:
regsvr32 xyz.dll OR regsvr32 /i xyz.dll

answered on Stack Overflow Jul 20, 2011 by Yahia • edited Sep 23, 2014 by Shahid Iqbal

User contributions licensed under CC BY-SA 3.0