2 Sep 2020

learnforge Modify Your Models - VB.NET

Have just written here about converting the AppBundle generated by the Visual Studio project template for Design Automation for Inventor to VB.NET. The same utility I used there, can also be used to convert the ASP.NET Core C# project shown on the learnforge website to VB.NET 
The finished tutorial can be found here and that was my starting point.

I only focused on converting the ASP.NET Core project, because that is what everyone can use no matter which desktop product they are interested in.

Once I installed the Code Converter VS extension, I could open the solution, right-click on the "forgesample" project and click "Convert to VB"

Convert to VB

When I tried to compile the project I ran into quite a few errors:Compile issues

The first issue was the same one I found during the AppBundle conversion, i.e. the code was using "dynamic" instead of "Object". So I just had to search for "dynamic" in the entire solution/project and replace them all:

dynamic to Object  
The naming of one of the variables was clashing with a class name, so just had to rename it to something else:

Renaming activity to act

Then had to add "Imports System.Text" so that "Encoding" could be found:

Imports System.Text

And last, I had to explicitly cast the input parameter of RestClient() to a String using CType():

Use CType to cast input parameter to String

As you can see in the picture at the top of the article, after all this, I managed to run the project just fine. Here is the finished project: https://github.com/adamenagy/Container/blob/master/learn.forge.designautomation-VB.NET.zip

Note: while I was fixing the issues in the converted project, I could hardly find any relevant VB.NET samples on the net. All the useful ones were C# and the VB.NET ones tended to be about something else than what I searched for. 
My feeling is that for web development VB.NET is not as popular as C#, so in the long run, it's probably worth investing in learning C# if you want to stick with Microsoft web technologies

Tags:

Related Article