Results 1 to 8 of 8

Thread: Import c# project into VB.NET Project

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2021
    Posts
    166

    Import c# project into VB.NET Project

    I'm with my vb.net project and I found a ready c# solution but it's too big to convert to c# so I would like to bring all forms into my visual basic project is it possible to do this using only the main solution of my project?


    A related question is, When I compile will both c# and vb.net compile?

  2. #2
    Fanatic Member
    Join Date
    Jan 2006
    Posts
    710

    Re: Import c# project into VB.NET Project

    Your solution can have both VB and C# projects.

    (Also, why would a project be too big to convert?).
    David Anton
    Convert between VB, C#, C++, & Java
    www.tangiblesoftwaresolutions.com

  3. #3
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    38,989

    Re: Import c# project into VB.NET Project

    You could also make the C# project a dll, or reference it directly as a project in your larger solution. They work together pretty seamlessly.
    My usual boring signature: Nothing

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Apr 2021
    Posts
    166

    Re: Import c# project into VB.NET Project

    Quote Originally Posted by David Anton View Post
    Your solution can have both VB and C# projects.

    (Also, why would a project be too big to convert?).


    because it's a frequency pattern recognizer that I found in C# and it has many lines of code besides a dll.

    In case I add it to the project as a solution, how do I refer to this form so that I call it MDI child? it's possible ?

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Apr 2021
    Posts
    166

    Re: Import c# project into VB.NET Project

    Quote Originally Posted by Shaggy Hiker View Post
    You could also make the C# project a dll, or reference it directly as a project in your larger solution. They work together pretty seamlessly.
    Thanks this is important, but in this case the project itself already has some dlls so it's better to include the forms inside the main solution (VB) I wanted to know if it is possible to also add an external .exe inside the references as if it were a txt or file , because depending on I create the .EXE and set it to TopLevel false and call it by main.

  6. #6
    Fanatic Member
    Join Date
    Jan 2006
    Posts
    710

    Re: Import c# project into VB.NET Project

    I think you should be able to refer to the form like any other form, whether it's in the VB project or C# project. I don't do this myself, so maybe I'm missing something, but I don't see why it shouldn't be possible.
    David Anton
    Convert between VB, C#, C++, & Java
    www.tangiblesoftwaresolutions.com

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,302

    Re: Import c# project into VB.NET Project

    You're asking questions that you already know the answer to, so put some thought into it. You use types defined in other libraries all the time. Why should this be any different? Add the prohject to your solution, make sure it compiles to a library rather than an application, reference it in your application project and away you go. You use the types in that library the same way you use the types in any other library you reference, which you have been doing since the very first project you created. You're trying to make this hard when it's not.

    There's also no need to add the project to your solution if you don't intend to make any changes to it or need to debug it along with your app. You can just build the project on its own and then you can reference the DLL it generates like you would any other DLL. If you add the project to your solution, you can then reference the project instead of the output DLL, which allows you to debug into that project and make changes to the code and have them reflected immediately in your application project.

  8. #8
    Fanatic Member Peter Porter's Avatar
    Join Date
    Jul 2013
    Posts
    532

    Re: Import c# project into VB.NET Project

    Quote Originally Posted by LiwisJames View Post
    Thanks this is important, but in this case the project itself already has some dlls so it's better to include the forms inside the main solution (VB) I wanted to know if it is possible to also add an external .exe inside the references as if it were a txt or file , because depending on I create the .EXE and set it to TopLevel false and call it by main.
    If the C# project references DLLs already, those DLLs will still work when you make the C# project a DLL.
    Last edited by Peter Porter; Aug 16th, 2021 at 03:44 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width