This is a "Top 14" list of things to keep in mind when coverting your code from Visual Basic 6 to REALbasic.
1. Replace any & used for concatenation (bad programming practice anyway!); use + instead. Left("Honk", 1) & "ank" becomes Left("Honk", 1) + "ank"
2. Dim all variables on a single line to ensure YOU understand what they are supposed to do.
3. Use As Integer, not %, etc., in your code.
4. Be sure to remove DefXXX in each Form and Module to detect your data types.
5. Visual Basic Integers (16-bit) will become REALbasic Integers (32-bit longs values) in REALbasic, so check the logic of your code.
6. Do not use Visual Basic currency or byte data types unless you really need them.
7. Use Visual Basic Chr/Asc as Byte replacement.
8. Use Double as Currency replacement.
9. Visual Basic Error Handling will get Rem'd out, but you can locate it and fix it.
10. Remove line numbers as they are not supported in REALbasic.
11. Goto supported, but only with string label (no numbers).
12. Move as much code as possible from forms into modules. (In general, VB Project Converter does a better job with modules, and you can actually open a module directly using REALbasic without using VB Project Converter at all, if you wish.)
13. GoSub not supported, so replace with functions/methods as required.
14. Database will require some re-work, but SQL logic is largely compatible.
Well, let's hit this list, shall we? Numbers 2, 3, 4 and 13 are the same in .NET. Number 1 is more efficient in .NET than using the plus (+) sign. If you use & on your strings, it concatenates them. If you use plus on your strings, it checks to see if both sides of the equation are numeric, and if they are, it converts them to numbers, adds them, and converts the result back to a string. Sounds like a fairly major consequence to not point out, eh?
In Visual Basic .NET, you can use bytes. You need to use a MemoryBlock in REALbasic. You get Shorts in VB.NET for 16-bit integers, you need to use MemoryBlocks or upgrade to a 32-bit integer in REALbasic.
However, I'm willing to let that slide given that REALbasic is designed as a cross-platform BASIC, but we'll see after a prolonged test. I plan to use this entire weekend evaluating this language and compare it to Visual Basic .NET 2003. Who will come out on top? Tune in next week and find out, or try it yourself at:
http://www.realbasic.com/vb6/index.php?id=KQMCNGQN
No comments:
Post a Comment