By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,002 Members | 1,361 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,002 IT Pros & Developers. It's quick & easy.

ActiveX UserControl

P: n/a
Dan
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.
Nov 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]

"Dan" <Da*@discussions.microsoft.com> wrote in message
news:13**********************************@microsof t.com...
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.


Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.