views:

96

answers:

2

I am looking for a utility/tool to convert calls to legacy VB6 functions to the .NET equivalent.

For example, it would convert this...

FormatCurrency(Cart.TotalAmount)
Len(Str)
UCase(Str)
UBound(PaymentsArray)

To this...

Cart.TotalAmount.ToString("c")
Str.Length
Str.ToUpper()
PaymentsArray.Length - 1

Does anybody know of one, or am I going to have to roll my own?

+2  A: 

Do you need a conversion for those functions? The vb6 functions work just fine in vb.net.

xpda
Currently. I suspect that someday they will get rid of Microsoft.VisualBasic.dll? We want to get rid of it now.
Josh Stodola
You do make a good point though!!
Josh Stodola
You could delete the reference to microsoft.visualBasic.dll and correct the errors using regular expressions for search and replace. However, some of the functions don't behave precisely the same. For example, .net str.trim() trims carriage returns, but vb trim(str) does not.
xpda
Microsoft.VisualBasic.dll is 100% part of .NET and will be around as long as .NET is around. http://stackoverflow.com/questions/226517/is-the-microsoft-visualbasic-namespace-true-net-code/226708#226708
MarkJ
+1  A: 

If your code is already converted to working VB.Net, why not just leave the calls as they are? The routines are in Microsoft.VisualBasic.dll which is a fully supported part of the .NET framework and will be around as long as .NET is around. Avoid using them in new code if you like, but doing extra work to take them out of existing code seems rather unecessary.

If you haven't yet converted the code, you could choose to buy Artinsoft's VB Upgrade Companion which can do some of the conversions you ask for, as part of the VB6 to VB.Net conversion.

MarkJ