We have tested VB Migration Partner on a large number of Visual Basic 6 projects, including applications developed internally or submitted by early adopters, examples taken from books, and open source programs.
In this page we summarize the most interesting samples we downloaded from the Internet. We have included the original URL whenever possible; however, in some cases we found these applications on our hard disks and all our attempts to locate their original URL failed. We also attempted to contact the original authors of all these samples to let them know about our initiative, but only a fraction of them answered, perhaps because most of these samples date back to year 2001 or earlier and the author’s email is no longer valid.
Before you try the VB6 and VB.NET samples in this page, the following disclaimers are in order:
a. We aren’t claiming in any way that we are the creators or that we own the copyright of any code sample listed in this page, except where noted.
b. These samples are included for illustration purposes only. We don’t guarantee that the original Visual Basic 6 application works correctly under all circumstances and we aren’t endorsing it in any way.
c. We don’t guarantee that the converted VB.NET works correctly in all cases, because it might have inherited problems from the original source code.
d. If you are the author of the sample and want to have your sample removed from this page, just send us an email.
e. If you happen to know the exact URL of samples for which this piece of information is missing, please let us know.
An important note: we haven’t modified the original Visual Basic 6 source code in any way, except where noted. In most cases, our edits are limited to the addition of one or more pragmas. We have summarized all the edits in a file named MigrationNotes.txt, included in each VB.NET sample. Likewise, we have not modified the VB.NET generated by VB Migration Partner in any way.
Most VB6 samples have been instrumented with a few pragmas whose only effect is to suppress the “noise” caused by the many warnings related to code analysis, such as unused Const and Declare statements or ByRef parameters that could be bettered rendered with by-value semantics. In some cases, we included pragmas that conveniently copy data files from the VB6 folder into the VB.NET project. Such pragmas aren’t strictly necessary to have a working VB.NET application, therefore they aren’t mentioned in the list of the pragmas that are required for a correct conversion.
Samples from “Programming Microsoft Visual Basic 6”
by Francesco Balena – © Code Architects Srl
One hundred code examples and 2 megs of source code taken from Francesco Balena’s top-seller book. These samples truly stress VB6’s advanced features, including advanced graphics, object-oriented programming, database programming, forms and controls, databinding with custom data formatting, OLE drag-and-drop, basic and advanced user controls, COM components, ADO data source and data consumer classes, and Windows API methods. If an automatic conversion tool can handle these samples, it can handle anything…
We’ve rarely seen a better demonstration of Visual Basic’s graphic capabilities than this stunning application. It uses just Windows API calls – no DirectX, no OpenGL – to render, rotate, animate, etc. complex solid shapes made of thousands polygons…and does it blindly fast! What is even more unbelievable – if you aren’t familiar with VB Migration Partner, at least – is that you can convert this baby in less than 10 seconds. The resulting VB.NET code runs fine at the first attempt!
VB Migration Partner migrates correctly even VB6 WebBrowser control. Amoung its features we find auto-complete URL, print, HTML source window, back and forward support, progress bar and favorite window.
This sample demonstrates how powerful is our migration engine, which converts it with no need for any pragma.
An interesting tiny application that does spell checking, and does it very well. It comes with a database of over 450,000 words and uses Soundex and Levenshtein distance to find all the words that have a pronunciation “close” to a word your type. VB Migration Partner converts this program to VB.NET without having to edit the original code in any way.
A nice application that teaches you the sign language. It uses Windows API methods to create a transparent, non-rectangular form and has a few other challenges, but VB Migration Partner is quite able to handle it, after adding a couple pragmas. The converted VB.NET application works exactly like the original one, but you might want to adjust its fonts and graphical appearance after the migration.
Enter your latitude and longitude, current date and time, and watch how the sky looks like! It comes with a large star database in text format, thus you just need to hover the mouse on a given star and learn its name, brightness, distance, etc. VB Migration Partner converts this sample flawlessly, after we added a few ReleaseHDc statements to deallocate the device context that the hDC property created.
The only (minor) difference from the original sample is that you can’t move your perspective by pressing Shift+left arrow (or Shift+right arrow) because – quite oddly – these key combinations aren’t intercepted by the .NET PictureBox control, thus the converted application uses the Alt+arrow key combination instead.
You can generate Bar 29 and Bar 128-styled bar codes of different size, with or without a label, copy them to the clipboard and save them to a file. The converted VB.NET sample works exactly like the original VB6 application, after adding just a few pragmas. It’s a great demonstration of VB Migration Partner’s graphic capabilities.
An MP3 player that uses nonrectangular forms, makes lots of calls to the Windows API, and peeks at data buried inside binary data. As if it weren’t enough, the application uses transparent Image controls to create hot spots and non-standard push buttons. This sample is a big challenge for any conversion tool.
After the migration the player works correctly is fully functional, including drag-and-drop of MP3 files from Windows Explorer. There are a few minor issues, though: the Playlist window displays spurious red pixels and the Open Dialog fails if multiple files are selected. (The latter problem is caused by a limitation of the P/Invoke portion of the .NET Framework.) Also, the nonrectangular windows display incorrectly under Microsoft Vista, but this defect is present in the original VB6 application as well.
A simple photo browser and viewer, with thumbnail support and three controls that aren’t supported natively by VB.NET, namely DriveListBox, DirListBox, and FileListBox.
The VB6 code migrates correctly without the need for any pragmas. The VB.NET code works as intended, except that the current image in thumbnail view isn’t displayed correctly. The reason: the VB6 program uses an Image control with red border and transparent background to display a frame around the selected image. The .NET Framework doesn’t support Image controls with transparent background; VB Migration Partner does support such controls, but only if they have no border.
A browser for ZIP files that can peek at compressed files and extract them to a folder. It demonstrates that VB Migration Partner correctly converts complex Declare statement (e.g. SHBrowseForFolder) and that nontrivial Structures are correctly read from and written to disk. The sample consists of 4000+ lines of code, subdivided in 5 modules and 11 classes, yet it takes only one migration pragma to convert and run correctly as a VB.NET application.
An MDI application to manage students, classes, and so forth. With its 30 forms and 3 modules, this program is more akin to a real-world business application than most other samples in this page. (We would like to offer more examples like this, but few business applications are available as open source.)
We had to add just two pragmas to have it compile and execute correctly under VB.NET. All the features of the original application are converted correctly except print reports. (VB Migration Partner doesn’t support the DataReport designer.)
A nearly perfect replica of the classic arcade game. The VB6 code uses quite a few advanced features, such as playing WAV files, displaying complex graphics, and animating multiple sprites using the BltBit API function. Only a conversion tool that relies on a support library can convert such an application.
For the VB.NET project to run correctly we had to add one ArrayBounds pragma and some InsertStatement pragmas. The only relevant defect in the VB.NET code is an excessive amount of flickering, an issue that can be easily fixed by means of double buffering. (Such flickering is especially noticeable under Microsoft Vista with Aero theme.) Except for this detail, the VB.NET version of the game is fully playable.
A nontrivial Notepad-like MDI Application, which leverages a vast assortment of features.
A couple of pragmas have been inserted in the original VB6 code to ensure that the splash screen be displayed correctly and to ensure that the MDI child window to appear in normal (nonmaximized) state.
A handy utility that uses the SQLDMO type library to find all the SQL Servers on the network, explore their tables and indexes, export the result to Microsoft Excel, etc. The VB.NET version compiles and runs correctly at the first attempt, without the need of any pragma.
A truly astonishingly simulation of a ciphering machine. BC-52’s source code is commented more than adequately, yet you need to be a ciphering guru to understand what each statement does. As if ciphering wasn’t a complex topic enough in itself, this code relies on many advanced VB6 programming techniques, such as transparent Image controls used to detect mouse activity and simulate “pushable” keys. We can’t think of how we could have translated it to VB.NET without an automatic conversion tool like VB Migration Partner.
The VB6 code migrates without any problem and the VB.NET application behaves almost exactly like the original one. There are a few minor issues, graphical output is slightly different from the original version, and a few options don’t work correctly. We consider the ability to migrate such a complex application as a big success of our software.
A simple utility that allows you to scan a CD and archive its contents on an MDB database for subsequent searches. We added one ArrayBounds pragma to handle an array with nonzero lower index and two UseSystemString pragmas to pass a structure to the FindFirstFile/FindNextFile Windows API methods.
A simple MasterMind game, where you have to guess the hidden color combination chosen by the computer. A black dot in the result pane means that you guessed a color in the right position, whereas a white dot means that the color is in the solution but in a different position. It’s a lot of code (over 4000 lines), but we needed just two pragmas to have it run correctly under VB.NET.
Another program to store names, addresses, and phone numbers. In spite of its simplicity, this sample is a serious challenge for an automatic conversion tool. It uses the Shell_NotifyIcon Windows API method to display an icon in the tray area and shows a popup menu when the icon is clicked; it displays a print preview dialog that relies on graphic methods and custom ScaleMode settings. It took us only 7 pragmas to solve these issues and have the VB.NET code run flawlessly.
A small but useful utility that records your mouse clicks and movements, saves them to file, and replays them so that you can automate many repetitive tasks. This sample counts fewer than 1000 lines, yet it uses many Windows API calls. VB Migration Partner converts it to VB.NET without the need of any pragma.