This is an updated version of an article that originally appeared in REALbasic Developer Magazine 6.1 (Nov/Dec 2007).
You’ve all heard the news: Visual Basic is dead. Support for Microsoft Visual Basic 6 has pretty much ended and you will soon be completely on your own. Microsoft wants you to move to their powerful, but extremely complex .NET platform.
I can hear you all screaming “No!!!, say it isn’t so”. But it is so. So what are your options? The way I see it, you have these options:
I’ll cover each of these options and hopefully convince that you should strongly consider REALbasic.
The easiest option is to just stick with the status quo and use Visual Basic as you have been for years. It’s worked this far, why not keep using it? Well, the world has not been standing still since Visual Basic 6 was released in 1998. Vista is out now and VB6 does not have any Vista support, although applications seems to work fine with it. For now. Mac OS X and Linux are also a lot more common now, which might be something you should consider.
The IDE UI for VB6 is also dated. It’s an MDI application with a bunch of Windows that are all over the place. Frankly, it is a bit ugly to look at:
And the VB6 language, although easy to learn, is also not all that powerful either. For one thing, its object-oriented capabilities leave much to be desired. It doesn’t have inheritance, for example. You’re forced to use interfaces to work around it.
If you stick with VB, where will you get your support? Microsoft ended mainstream VB support some time ago. You can still get some support from them for a few more months if you’re willing to pay for it, but after that you’ll be on your own.
I don’t think that burying your head in the stand and continuing with VB6 is a good idea.
Microsoft recommends you switch to .NET, so it must be the way to go, right? Don’t be too sure! If you have never worked with .NET, switching from VB will be a daunting task. The framework documentation is immense, so you’ll have a lot to learn. A printed copy of the .NET 1.1 framework reference guide is over 2 feet tall. .NET 3.5 is even larger! And don’t forget that Microsoft is rolling out changes to .NET at a furious pace. Visual Studio 2010 (with .NET 4.0) is now in beta and is scheduled for release in early 2010. Each of these new versions adds lots of new features and lots of complexity. It is hard to keep up.
Microsoft used to refer to the version of Visual Basic included with .NET as VB.NET. Now they’ve taken to just calling it Visual Basic. But even though it shares its name with Visual Basic 6, it is really an entirely new language and has almost nothing in common with VB6. The language features and object model are completely different. Microsoft does provide a migration tool, but it works about as well as any migration tool, which means “not well”.
And what about cost? Sure, Visual Basic 2008 Express is free, but it has a lot of limitations. You’ll probably want to shell out for at least the Standard edition ($257 from Programmer’s Paradise), but probably the Professional edition ($696 from Programmer’s Paradise).
Switch to Something Else
Of course, there are other choices as well. You could always give Delphi 2010 a try, but it’s $900 for the Professional edition. It’s also uses Pascal (albeit an object-oriented version). I liked Pascal in the 80′s, but who seriously wants to work with it now?
You could also consider Java (recently bought by Oracle), but if you thought .NET is complicated you’re in for a real treat with Java. The biggest benefits for Java is that nearly everything for it available for free. The biggest downside is that you’ll spend much more time and money learning how to use than you would have spent by choosing another option. And although Java is cross-platform, it takes a lot of work to create a UI that looks decent on multiple platforms.
Now this just might make more sense! The REALbasic language should look quite familiar to VB programmers. It is a different, though fully object-oriented, language, of course, but it is very easy to see how things are connected. The REALbasic framework is well organized and easy to understand. It’s also concise, so you can learn it all in a short time.
The IDE works great with multiple tabs as you would expect any modern development IDE to do. Additionally, REALbasic is updated regularly (every 90 days, in fact). And these updates are small and focused, so you can stay on top of the changes.
And I saved the best for last: REALbasic is cross-platform! REALbasic itself runs on Windows, Mac OS X and Linux and can create applications that run on Windows, Mac OS X and Linux. You can do your development on whatever platform you prefer but deploy to the platforms your customers use. And since you’re coming from VB, which is Windows-only, you can also grow your customer base by branching out beyond Windows, which might be significant depending on what your application does.
Check out accompanying sidebar for more information regarding REALbasic and Visual Basic.
Hopefully, you have now realized that REALbasic ($100 for the Personal edition) is worth a look. If you haven’t already, download the REALbasic trial for your platform.
Eventually you’ll want the Professional edition ($300), though, since it has advanced features such as Container Controls and cross-platform compiling. New for 2009 is REAL Studio, which includes REALbasic Professional for all three platforms, additional support and a license to REAL Server (their SQL database server). At $1000, it is not cheap, but it does cost less than buying everything separately.
REAL Software also has a new tool, the VB Migration Assistant, available for free on their web site. This tool migrates your VB code and controls to REALbasic. The code itself is not changed (it simply migrates it as comments), but it is a great way to get your VB project into REALbasic so you can migrate it all in one place.
AYB Computers also makes a tool to help with VB migrations. Their product, VBConvert!, actually attempts to migrate all your code and controls. At $50, it’s worth the investment.
Realistically, if you have a Visual Basic application and are thinking it should be moved to REALbasic, then you need to do a bit of analysis first. No tool is going to magically make your VB project work 100% in REALbasic.
Ask yourself if your application needs to be an exact port or does it just need to replicate functionality? In many cases, you can create a much better design in REALbasic than you could have with Visual Basic because REALbasic is a much more powerful language with better object-oriented capabilities.
Does your application make use of many 3rd party controls and libraries? Not all of these will work with REALbasic, and even if they do they would prevent you from creating a cross-platform application. Think about what your using and why. Perhaps there are equivalent 3rd party controls available for REALbasic or perhaps you don’t really need them after all.
As you might expect, Visual Basic and REALbasic have a lot of similarities.
Syntax
As you might guess since both Visual Basic and REALbasic have “basic” in their name, the language syntax is very similar. You’ll see familiar syntax for For..Next, While..Loop, If..Then..Else, Dim and many other commands. You’ll have no trouble at all reading (or writing) REALbasic code.
Although REALbasic’s data types are not always named exactly the same as the Visual Basic ones, all the equivalent types are there. For example, the REALbasic Integer is equivalent to the VB Long (figure 3).
The default UI controls included with VB are, for the most part, also included with REALbasic (figure 4).
REALbasic also has several controls that are not included by default with VB (figure 5). Of course, there are plenty of available controls for VB that can be added to its default setup. REALbasic can use some of these 3rd party VB controls, but not all of them.
Of course, REALbasic also has quite a few differences from Visual Basic as well.
REALbasic cannot create DLLs, ActiveX controls or any kind of shared libraries. Since these are all Windows-specific technologies, that is somewhat understandable. You’ll either need to rethink your design here or just re-use these components from within REALbasic (and thus limiting yourself to just deploying on Windows).
As I’ve mentioned before, REALbasic is fully object-oriented. Unlike VB, you can have real classes with real inheritance and other object-oriented properties.
One of the biggest differences between VB and RB is file I/O. REALbasic consolidates all its file processing into a few classes: FolderItem, TextInputStream, TextOutputStream and BinaryStream. VB uses hard-coded file paths and less flexible file access methods, primarily because it is Windows-specific. Any code that you have in VB that references files will need to be converted to use the equivalent REALbasic classes.
REALbasic is strongly typed. Visual Basic allows you to do some things the “old-school” BASIC way, the most significant of which is using variables without declaring them. REALbasic does not allow this. Use the OPTION EXPLICIT command in all your Visual Basic code to have VB enforce explicit variable declarations.
I think I’ve given you a lot to chew on in this overview. Give REALbasic a try; you’ll be glad you did!
| VB Data Type | RB Data Type |
|---|---|
| Boolean | Boolean |
| Byte | Byte |
| Currency | Currency |
| Date | Date (Date is a class in REALbasic) |
| Double | Double |
| Integer | Short |
| Long | Integer |
| Object | Object |
| Single | Single |
| String | String |
| Variant | Variant |
| n/a | Color |
| n/a | Int64 |
| n/a | UInt16 |
| n/a | UInt32 |
| n/a | UInt64 |
| VB Control | Equivalent RB Control |
|---|---|
| PictureBox | Canvas |
| Label | StaticText |
| TextBox | TextField |
| Frame | GroupBox |
| CommandButton | PushButton, BevelButton |
| CheckBox | CheckBox |
| OptionButton | RadioButton |
| ComboBox | ComboBox |
| Listbox | Listbox, PopupMenu |
| HScrollBar | ScrollBar |
| VScrollBar | ScrollBar |
| Timer | Timer |
| DriveListBox | n/a |
| DirListBox | n/a |
| FileListBox | n/a |
| Shape | Oval, Rectangle, RoundRectangle |
| Line | Line |
| Image | ImageWell |
| Data | DatabaseQuery, DataControl |
| OLE | OLEContainer |
| RichTextBox | TextArea |
| TabStrip | TabPanel |
| WebBrowser | HTMLViewer |
| MSFlexGrid | ListBox |
| WindowsMediaPlayer | MoviePlayer |
| ProgressBar | ProgressBar |
| Toolbar | Toolbar |
| StatusBar | n/a |
| Slider | Slider |
| TreeView | ListBox |
| ListView | n/a |
| ImageCombo | n/a |
| ImageList | n/a |