If you ever get an assignment where you are asked to migrate or rewrite an existing VB6 code base, then keep the following things in mind:
Arithmetic operations differ between .NET and VB6
Yep. If you have a code like below in VB6 then you need to be careful:
x = y/12
If y is 1 then x is 0.083333 in VB6. If you run the same code in .NET, it is 0. To get parity between the two you will need to use following in .NET
x = y/12.0
Tool based migrated code isn't the best code
Let us accept that VB6 code was generally written to best utilize the capabilities available at the time when the code was written. World has changed then but companies did not spend money on changing their code - they are generally forced to change the old (legacy) code when some sort of support is going off. Then comes the usage of some sort of migration tools. There are plenty of good tools available in market which can migrate an existing VB6 code to .NET with high level of accuracy (they never claim 100% accuracy). So your real trouble starts when you try to work with the code migrated by a tool which is partially accurate :).
What is more interesting is that such code bases (which were written in VB6 a few decades ago and maintained since then), would not have any type of unit tests which you can use to confirm if the migrated code is correct.
Continue on Error
This was a killer feature in VB6 language. You work with some data and you get an exception - you tell the program to not bother about the exception and move on the next set of activities. This was extremely useful in cases where you needed to process set of records fetched from database or file.
When you migrate to .NET, you would cringe for such feature. The best way to match that logic (of course you can not force a business to change its core logic because they are changing from VB6 to .NET) is to catch and suppress exceptions for each record so that you can keep moving forward.
VB6 is generally faster
Yeah. It is kind of true. At least it would feel like that.
VB6 is 32 bit
And this would mean if your legacy code base has an existing component which does not have its source code (Yes, it is true. I have met such customers.) then you would have only 2 choices - keep migrated .NET application as x86 application or wrap that component logic in a separate 32 bit process and keep remaining application as 64 bit. That would mean one serious issue - latency and one additional application to maintain. You can speed it up by hosting it existing DLL in a WCF service behind net.pipe binding but it can never beat in-process calls.
Arithmetic operations differ between .NET and VB6
Yep. If you have a code like below in VB6 then you need to be careful:
x = y/12
If y is 1 then x is 0.083333 in VB6. If you run the same code in .NET, it is 0. To get parity between the two you will need to use following in .NET
x = y/12.0
Tool based migrated code isn't the best code
Let us accept that VB6 code was generally written to best utilize the capabilities available at the time when the code was written. World has changed then but companies did not spend money on changing their code - they are generally forced to change the old (legacy) code when some sort of support is going off. Then comes the usage of some sort of migration tools. There are plenty of good tools available in market which can migrate an existing VB6 code to .NET with high level of accuracy (they never claim 100% accuracy). So your real trouble starts when you try to work with the code migrated by a tool which is partially accurate :).
What is more interesting is that such code bases (which were written in VB6 a few decades ago and maintained since then), would not have any type of unit tests which you can use to confirm if the migrated code is correct.
Continue on Error
This was a killer feature in VB6 language. You work with some data and you get an exception - you tell the program to not bother about the exception and move on the next set of activities. This was extremely useful in cases where you needed to process set of records fetched from database or file.
When you migrate to .NET, you would cringe for such feature. The best way to match that logic (of course you can not force a business to change its core logic because they are changing from VB6 to .NET) is to catch and suppress exceptions for each record so that you can keep moving forward.
VB6 is generally faster
Yeah. It is kind of true. At least it would feel like that.
VB6 is 32 bit
And this would mean if your legacy code base has an existing component which does not have its source code (Yes, it is true. I have met such customers.) then you would have only 2 choices - keep migrated .NET application as x86 application or wrap that component logic in a separate 32 bit process and keep remaining application as 64 bit. That would mean one serious issue - latency and one additional application to maintain. You can speed it up by hosting it existing DLL in a WCF service behind net.pipe binding but it can never beat in-process calls.