문제

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.

도움이 되었습니까?

해결책

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

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top