Question

I have a user control created in a C# solution and I have to use that control in an existing form in VB. I am new to vb. Please help me out in this.

Thanks in advance.

Was it helpful?

Solution

I have set the control like this when loading the data:

   Set mctldemo = Controls.Add("Democtl.Control", "ctlDemo", Me)

But forgot to mention the ClassInterface as shown in this link

[ClassInterface(ClassInterfaceType.AutoDual)]
    [ProgId("Democtl.Control")] 

Thank you all for responding to my question and thank you Nadeem_MK for the link

OTHER TIPS

It seems this is not supported. I've never tried - why would I - but others have:

However according to support documents, it may be just barely possible to make it work by hosting the dotNet usercontrol within a WebBrowser instance on the VB6 control.

But I really suggest you don't do that. I can't help thinking it would be easier to upgrade the whole form to dotNet... indeed the whole project to VB.Net...

Alternatively you could rewrite the usercontrol as a VB6 usercontrol.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top