COM Interop with VB6 and C#

旧时模样 提交于 2019-12-06 16:24:08

You should put code for updating the text box and any other UI specific code in to a VB6 COM object, and hand off any non-UI code to a C# class, then you will not have to deal with a VB6 UI control in C#.

Are you using .Net 4.0?

You could try using the new dynamic language features:

public void Test(object input)
{
    dynamic textBox = input;
    //Assuming there is a property named Text at runtime
    textBox.Text = "arbitrary string";
}

This should do the equivalent of late binding in COM.

You might also try using dynamic in your method declaration.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!