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 Iteams' 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))<br />
at System.Windows.Forms.Design.DocumentDesigner.AxToolboxItem.CreateComponentsCore(IDesignerHost host)<br />
at System.Drawing.Design.ToolboxItem.CreateComponentsCore(IDesignerHost host, IDictionary defaultValues)<br />
at System.Drawing.Design.ToolboxItem.CreateComponents(IDesignerHost host, IDictionary defaultValues)<br />
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"
pls help me.
many thanks