ActiveX UserControl

G

Guest

Good Day All,

I am in the process of migrating a VB6 application to .NET using C#. The VB6
application has a bunch of ActiveX user controls that it load dynamically
depending upon the situation at hand. I would like to be able to use these
controls initially until I have the time to migrate them to .NET. I know I
can add an ActiveX control to a WinForm during design time and it will
generate a Com Interop wrapper for me and it works great.

However, I am not sure how/if I can do this at run time. Right now the
controls implement a common interface and I can just create the object that I
need and display it to the user. Unfortunatley, I have not been able to get
these controls to behave that way using .NET. The only thing I have come up
with is to wrap each control in a .NET control, using Visual Studio, but I
really don't want to have to go through all of that work right now.

Can I do this? Any ideas, samples, suggetions would be appreciated.
 
D

Dmytro Lapshyn [MVP]

Hi Dan,

As far as I remember, you will need to create an interop assembly first with
TlbImp.exe.
Then, use AxImp.exe to create a wrapper .NET control for your OCX control.

Finally, reference the both assemblies from your .NET project and create the
generated wrapper control dynamically whenever appropriate.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top