Porting a .bas file to vb.net

Kevin Boyd picture Kevin Boyd · Feb 21, 2011 · Viewed 11.5k times · Source

I'm working on some legacy VB5/VB6 code and need to convert a ".bas" file to vb.net.

I found several options

  1. Compile the .bas file into a com dll and then reference and use it in my project. (For this I guess I would need vb5 or vb6 which I don't have at my disposal)

  2. Copy and paste the contents of the file in to a new module in vb.net and then try solving the errors one by one.

The contents of the .bas file reference a particular dll. The .bas file has mostly declarations consts, types, sub's and functions.

What would be the most elegant way of redoing this in vb.net. Is it as simple as option 2.

EDIT

I used VS2008 express and ran the code through the upgrade wizard it did the necessary conversion. and the .bas file was converted to .vb. I took that file and decided to rewrite other parts of the code, including some redoing of the converted .vb file.

Other questions related to this one are here.

Answer

Konrad Rudolph picture Konrad Rudolph · Feb 21, 2011

Consider rewriting as an alternative. In my experience, this makes less work in the long run than either relying on an opaque COM library or using the VB6 migration wizard and picking up the pieces it spits out.

Depending on your knowledge of .NET, the rewrite of a single VB6 module shouldn’t take very long. If you are freshly starting with .NET then this may take longer but it will also provide good opportunities to learn .NET.