UserControl.Parent

I have a VB6 ActiveX control that is hosted on a .NET form (obviously, the aximp util was first used). It works fine except that the control invokes a public property on the parent form:

   UserControl.Parent.MyPublicProperty = True

The app then dies with an error in the VB6 error handler, displaying the message:

   Runtime error ' 5'

   Invalid procedure call or argument

 

I assume I have an interop problem. However, I don't know how to fix it.

Is there a way that I can use the code "as is" I don't have access to the code and I need to use the OCX. Any help would be greatly appreciated.

Todd

 



Answer this question

UserControl.Parent

  • Segundo Leon

    Yeah, that's the first thing I tried and it didn't work.

    What's confusing is since the ActiveX control requires an interop layer to communicate to the .NET-based form it is hosted on. However, the ActiveX control doesn't have a reference to this form so an interop wrapper is never created.

    Do you (or anybody) have any other ideas I'm on the hook for this ("sure, I can do that...") and I am out of ideas. thx in advance.

    todd


  • windpuffs

    That's an interesting one. I've never had to do this before, or even heard of people trying it :)

    Perhaps - and I say only perhaps - you might be able to get away with it if you add a property to the form that's hosting this usercontrol called MyPublicProperty and exposing it to COM with a COMVisible attribute.

    I've got no idea if it'll work, but that's all I can think of.



  • WimV

    Well, I'm out of ideas.

    Sorry!



  • UserControl.Parent