none
VB.NET wrapper for VB6 OCX

    Question

  • A while back I successfully built a VB.NET user control as a wrapper for a VB6 OCX. I now have to do the same thing but for a non Win Forms application i.e. a ASP.NET app.

    Is it possible to build a .NET assembly that can be called from a formless application (another assembly/ASP.NET/web service) that wraps the VB6 OCX?

    The control itself has no graphical presence only a handful of properties, method and events.

    Any advice appreciated.

    Monday, October 16, 2006 2:40 PM

Answers

All replies

  • It is possible to call a COM component from an Asp.Net application as long as you're not planning on showing any of the UI to the user.  You'll have to set the compatability mode to asp to get the apartment model correct.  The tag is <@%Page aspcompat="true" %>

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconpage.asp

     

    Monday, October 16, 2006 3:32 PM
  • Thanks for the tip (it'll be useful) but I'm not sure how I can use a VB6 OCX control either directly or by using a .NET wrapper without having a form to place it on.

    My aim is to have a flexible solution where I can call the functions of the control either directly from ASP.NET (or from the code behind), or have the ASP call a web service which calls the control.

    Any advice appreciated.

    Tuesday, October 17, 2006 8:47 AM