Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can .Net custom controls be used in VB6 form?

I am doing some maintenance on a VB6 Windows application. I have a .Net custom control component that I would like to use on a VB6 form. Is this possible? I know how to access non-visual .Net components from VB6 by generating a COM type library for the .Net DLL, but can a .Net custom control be used like a .OCX from VB6? If so, how is the control instantiated in VB6, added to the form, etc.

Thanks in advance for any replies.

like image 571
E Brown Avatar asked Jan 19 '09 21:01

E Brown


2 Answers

The Interop Forms toolkit will give you what you need:

http://msdn.microsoft.com/en-us/vbasic/bb419144.aspx

It lets you create UserControls in VB.net which you can then add to VB6. It also lets you display .net forms from your VB6 code.

I've used it successfully to give my old VB6 code the .net toolbars - much nicer!

like image 174
Alex Warren Avatar answered Sep 28 '22 18:09

Alex Warren


This will lead you step by step through the process.

http://www.codeproject.com/KB/vb-interop/UsingDotNETControlsInVB6.aspx

It is not a perfect fit so you will have to explore how badly the limitations effect you.

like image 38
RS Conley Avatar answered Sep 28 '22 18:09

RS Conley