user3273580 user3273580 - 1 month ago 6
C# Question

Wrap a VB Windows Form Project in a C# Project's Window

I have a bit of a weird question. I'm not entirely sure how to phrase the question, but the general gist of the situation is that I am currently developing a plugin for a program in C# for some software called SDL Trados Studio. However, a lot of our code is currently in VB and I don't see that changing in the foreseeable future. There are plenty of tools out there that will let me convert the project from VB to C# that will take care of most of the syntax, but there is the occasional thing here and there that just cannot translate well from VB to C#.

I was wondering, if I have access to the source of both the C# project and the VB project, would it be possible to wrap the UI of the VB project and feed it input from the C# project?

I ask this because it would be much easier to just wrap the UI into my plugin as the VB code is still actively developed and it would become a tedious task to convert the VB project into C# before cleaning it up every time a new update is pushed to the code.

Thanks for the help!

Answer

You can always reference a DLL no matter what language it's written in, even unmanaged DLLs, but especially managed assemblies.

If your existing VB code is not already in its own DLL, but it in one, compile it, and reference it from your new project.