Launch VB Form from C # Form

My friend and I were working on a project for a class. He prefers VB and I prefer C #, so we just did our thing. Now we were thinking about merging projects. I added it to mine, but I cant find how to open the forms it made from the forms I made.

Is there a way to launch VB forms from a C # form?


source to share

4 answers

Can't mix C # into VB. but you can use the approach suggested by Jon Skeet.

1) Create multi-project solutions

2) Add your friend's VB project link to your project

Then you can create an object of those forms that your friend created as:

YourFriendProject.SomeForm  someForm = new YourFriendProject.SomeForm();




The language is specific to the project. This means you have a C # project and a VB project. You cannot mix multiple languages ​​in one project. However, you can have multiple languages ​​in your solution. For example, it does the front-end in VB and you do the back-end in C # and then add references to the vb project in the C # project.

Alternatively, you can use the VB to C # converter or vice versa with mixed results. I have converted entire vb projects to C #.



You cannot add different languages ​​to the same project, but you should be able to add both projects to the same solution and add a reference from your C # project to your VB project and use the types it creates - so if they are public , sure.



The answer has already been posted, just adding an image to make things clearer.

  • You cannot add forms / code from two different languages ​​to the same project.
  • You can add a project reference from a VB node to a CS assembly and vice versa.
  • You can add the project to another solution to have access to both.

enter image description here



All Articles