locked
Converting CSharp project to VB.Net project

    Question

  • Exactly how do I do that? I have converted the code, I just need to convert the project file now.
    Monday, July 21, 2008 12:53 PM

Answers

  • Question: Converting CSharp project to VB.Net project

    Hi Mrbaseball,

    C# and VB.Net are essentially identical.
    Here are one conversion tool which can be used to
    convert entire C# project to corresponding VB.NET project, also can convert code snippet.
    Instant VB: C# to VB converter

    Download Demo Edition: Instant VB


    Please check this similar issue for some suggestions:
    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2070671&SiteID=1


    This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.


    Best regards,
    Martin Xie

    Friday, July 25, 2008 6:19 AM
  • Windows Forms code files are composed by partial classes. One of them is designer-generated. Did you also convert designer-generated code?

    This is my suggestion if you have forms over than classes to convert, even if not so speedy:

    1. Run a first instance of Visual Studio and open your C# project;
    2. Run a second instance of Visual Studio and create a new VB project (or add a parallel VB project to your C# solution). Here add as many windows forms as you need.
    3. Go to the C# project and in the designer select and copy UI controls, then pass to your VB projects and paste controls themselves so that Visual Studio will add designer-generated code;
    4. Add to your VB project all code files you manually converted and not automated (in other words, your) VB code for Windows Forms.

    I hope the explanation was clear!

    HTH
    Alessandro Del Sole - Microsoft MVP http://community.visual-basic.it/Alessandro
    Wednesday, July 23, 2008 9:22 PM

All replies

  • I think the best choice is that you create a new VB project and then import converted code files.

    This is better because VB and C# projects differ not only in the .??proj file.
    Alessandro Del Sole - Microsoft MVP http://community.visual-basic.it/Alessandro
    Monday, July 21, 2008 8:59 PM
  • Means recreating the forms, doesn't it?
    Wednesday, July 23, 2008 12:01 AM
  • Windows Forms code files are composed by partial classes. One of them is designer-generated. Did you also convert designer-generated code?

    This is my suggestion if you have forms over than classes to convert, even if not so speedy:

    1. Run a first instance of Visual Studio and open your C# project;
    2. Run a second instance of Visual Studio and create a new VB project (or add a parallel VB project to your C# solution). Here add as many windows forms as you need.
    3. Go to the C# project and in the designer select and copy UI controls, then pass to your VB projects and paste controls themselves so that Visual Studio will add designer-generated code;
    4. Add to your VB project all code files you manually converted and not automated (in other words, your) VB code for Windows Forms.

    I hope the explanation was clear!

    HTH
    Alessandro Del Sole - Microsoft MVP http://community.visual-basic.it/Alessandro
    Wednesday, July 23, 2008 9:22 PM
  • Question: Converting CSharp project to VB.Net project

    Hi Mrbaseball,

    C# and VB.Net are essentially identical.
    Here are one conversion tool which can be used to
    convert entire C# project to corresponding VB.NET project, also can convert code snippet.
    Instant VB: C# to VB converter

    Download Demo Edition: Instant VB


    Please check this similar issue for some suggestions:
    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2070671&SiteID=1


    This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.


    Best regards,
    Martin Xie

    Friday, July 25, 2008 6:19 AM
  • Check out also this list:

    http://blogs.msdn.com/goto100/archive/2008/07/23/converting-from-c-to-visual-basic-net.aspx
    Alessandro Del Sole - Microsoft MVP http://community.visual-basic.it/Alessandro
    Friday, July 25, 2008 9:31 AM