Results 1 to 11 of 11

Thread: [RESOLVED] Tools or methods for "converting C# code into VB.Net code"

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,531

    Resolved [RESOLVED] Tools or methods for "converting C# code into VB.Net code"

    I often need to convert some C# code into VB.Net code. Initially I performed my conversion through the website "codeconverter.icsharpcode.net", which has a conversion accuracy of 90%. But recently the site seems to be not working, every time I open the site, it always shows "Loading..." status. Also, it seems that github.com always fails to open.

    I'd like to know if there are some other better tools or methods for "converting C# code into VB.Net code"? Thanks !
    Last edited by SearchingDataOnly; Jun 1st, 2022 at 05:34 AM.

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,689

    Re: Tools or methods for "converting C# code into VB.Net code"

    Try the Tangible Software converters. You can download the free versions

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

    Re: Tools or methods for "converting C# code into VB.Net code"

    This is the specific tool that .paul. is referring to:

    https://www.tangiblesoftwaresolution...converter.html
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,701

    Re: Tools or methods for "converting C# code into VB.Net code"

    Tangible Software converters has various options that allow control of conversions under the option menu or gear button in it's toolbar.

  5. #5
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,703

    Re: Tools or methods for "converting C# code into VB.Net code"

    I personally use Telerik's online converter. I don't know if it's any better or worse than the others suggested here. I have seen it fail to convert certain types of code. I use it mainly to convert small functions between languages or when I'm unsure how to represent a piece of C# code in VB.Net or vice versa.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  6. #6
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,689

    Re: Tools or methods for "converting C# code into VB.Net code"

    Quote Originally Posted by Niya View Post
    I use it... when I'm unsure how to represent a piece of C# code in VB.Net or vice versa.
    That's the reason i use the (Tangible Software) Instant C# tool. My VB is much stronger than my C# abilities, and the converter does a fairly accurate job usually.

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,531

    Re: Tools or methods for "converting C# code into VB.Net code"

    Quote Originally Posted by Niya View Post
    I personally use Telerik's online converter. I don't know if it's any better or worse than the others suggested here. I have seen it fail to convert certain types of code. I use it mainly to convert small functions between languages or when I'm unsure how to represent a piece of C# code in VB.Net or vice versa.
    "Telerik's online converter" doesn't seem to handle comments, blank lines and #if #else.

  8. #8

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,531

    Re: Tools or methods for "converting C# code into VB.Net code"

    Quote Originally Posted by .paul. View Post
    Try the Tangible Software converters. You can download the free versions
    Quote Originally Posted by jmcilhinney View Post
    This is the specific tool that .paul. is referring to:

    https://www.tangiblesoftwaresolution...converter.html
    Quote Originally Posted by kareninstructor View Post
    Tangible Software converters has various options that allow control of conversions under the option menu or gear button in it's toolbar.
    Tangible (Instant VB) is awesome. Although the free version can only convert 100 lines of code, it basically meets my requirements. Thank you very much.

  9. #9

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,531

    Re: Tools or methods for "converting C# code into VB.Net code"

    I'm thinking about a question:

    Can we use CodeDom and roslyn to write our own C# Code-Converter? Because I also sometimes need to convert some C# code to VB6 code.

  10. #10
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,703

    Re: Tools or methods for "converting C# code into VB.Net code"

    Quote Originally Posted by SearchingDataOnly View Post
    Can we use CodeDom and roslyn to write our own C# Code-Converter? Because I also sometimes need to convert some C# code to VB6 code.
    I believe so. CodeDom for sure because it's the engine the WinForms designers uses to generate the actual code when you drag and drop controls onto a Form in a WinForms project. Roslyn, I'm not so sure about. I know it is used in source generators and it can do some very amazing things but I'm not entirely certain Roslyn has much if any VB.Net support. It's always mentioned with C# more than anything.

    These technologies work with abstract syntax trees and expression trees at their heart so I would not be surprised if they could be used to create effective source converters.

    You could probably strap your own conversion algorithms onto Roslyn to convert C# code to VB6 if you wanted. It would at least save you from having to think about ASTs since it deals with all that. All you have to do is walk the AST and generate your VB6 code so all your time can be spent figure out how to generate the code and not on parsing the C# into a proper AST.
    Last edited by Niya; Jun 2nd, 2022 at 09:12 PM.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  11. #11

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,531

    Re: [RESOLVED] Tools or methods for "converting C# code into VB.Net code"

    What you said makes perfect sense. If I can get the JSON string of the AST of the C# code, I can use my Transpiler to convert the AST JSON string of the C# code into VB.NET and VB6 code.

    So, now the question is how do I get the JSON string of the AST of the C# code. I don't know if VB6 can generate JSON string of AST of C# code via roslyn-APIs or .Net.dlls

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