Tech Note 25: eVB2NSB Converter
September 21, 2009
© 2011 NS BASIC Corporation. All rights reserved.
The eVB2NSB Converter can be used to convert eMbedded Visual Basic projects to NS Basic/CE. As with any such conversion tool, it does not do a 100% conversion. It can reliably convert enough your project so that the final fix ups should not be too tedious.
We are continuing to improve this tool. To make it easier to see what is going on, the source code is available. Feel free to modify it for your own use and send us updates to the code. The source can be downloaded from eVB2NSB.zip. It is open source and written in VB6, so you are welcome to modify it.
If you would like NS BASIC Corporation to do the conversion for you, we can do so at a reasonable cost. Since we've done this a number of times, we are able to do this quickly. Send an email to email@example.com if you are interested.
Here is a detailed comparison of eVB and NS Basic/CE.
The eVB2NSB converter is available on the Desktop under the Tools menu.
Whenever you move to something new, the first thing you may notice are the things you are missing. Don't despair: NS Basic/CE will give you many other benefits in return. We are of course interested in your suggestions how we can make NS Basic/CE better.
Here are some of the benefits of conversion:
- Better performance - usually twice as fast
- More controls and objects
- Additional statements
- Develop on Desktop or Device
- Run on more devices
- Additional controls
- NS Basic/CE is continuing to be enhanced
How to run the conversion
- Start eVB2NSB
- Open your project
- Click on the Convert button.
- A list of notes will display about the conversion.
- A single output file called .txt will be produced.
- You can open this file in the NS Basic/CE desktop or on the device.
Things to keep in mind
- Object names must be unique. If eVB2NSB finds two objects with the same name, it will ask you to reopen the project in eVB and change one of them. Remember to change the name of any events for that object as well. An object also cannot share the name of a form.
- Variables that are global to a form in eVB are global to the project in NS Basic/CE. If you DIM the same variable name in two different forms, the second DIM will be ignored. Variables DIMmed within Subs or Funcs are unaffected.
- Form Properties: NS Basic's form is based on a Picturebox object, so it doesn't have all the properties that eVB does. Most are rarely used: they are Appearance, Caption, ControlBox, LockControls, ShowOK. Statements using these will be commented out in the converted code.
- MenuBars: NS Basic has a different way of doing menus. It's actually much simpler. There is a SetMenu statement that can be run at any time which sets the menu options, instead of the collection of Menu controls that eVB uses. eVB2NSB does not convert menus, so this needs to be done manually.
- Bitmaps: eVB includes bitmaps into the project itself, in a frx file. NS Basic leaves them as separate files. There is a utility that can be downloaded from the net called FRX Split 2.0 that can be used to extract bitmaps from a frx file.
- ListBoxes: eVB lets you set up preloaded values for listboxes in the IDE. With NS Basic, you need to do this in code. At this time, eVB2NSB does not extract the information (it is in the form.frx file) to generate this code, so it needs to be done manually.
- Timer Control: NSB does not need a separate Timer control. Instead, just set the Timer property of any intrinsic control: an event will be fired off that many milliseconds.
- Me: The Me object is not supported. eVB2NSB will turn statements that use Me into comments so you can fix them.
- Shapes: NSB cannot currently draw rounded rectangles. It draws square rectangles instead.
- Multiple statements per line: eVB2NSB does a pretty good job with these. It splits them up to separate statements to do the conversion. However, if you put IF...THEN... :END IF all on one line, it will not convert properly. Unwind these constructs before converting if you use them.
- Enum Constants are not automatically created. Some controls initialize a set of constants that are used by the control. You will need to add the ones you use to your program. A good place to put them is near the beginning. For example, the ADOCE control has a CursorTypeEnum, which initializes several variables such as adOpenForwardOnly. Add the following statements to your code to take care of this:
Const adOpenForwardOnly = 0
Const adOpenKeyset = 1
Const adOpenDynamic = 2
Const adOpenStatic = 3
Const adOpenUnspecified = -1
- Grid control: A grid may not have 0 rows.