开发者

Mixing VB5 and C# in a Windows Form application

I'd like to add a window to my application. Is it possible to "extend" an old vb5 pro开发者_Python百科ject using C#?

Is it easy to do and maintain and is it a good practice ? If not, what are the alternatives?


What you are trying to do is hard as you need to bridge the two worlds.

Both VB5 and C# can create and consume COM object you can use this to call VB5 code from .net or .net code from VB5.

You can also create and use Active X controls in .net, so you can mix VB5 and C# in the same form if you must.

Another option is to have two separate applications that talk to the same database and used COM (or SendMessage) to open forms in each other.

You need a deep understand of .net to get COM working well, however you are not likely to have that understanding until you have spent some time working in .NET.

There are also tools on the market that claim to convert VB5 code into VB.NET, however I have not tired any of them.


edit

I misread the question initially, thinking you were asking about VB.NET.

The best you can do is expose your C# as a COM object that you call from VB5. You just need to make sure you support IDispatch.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜