|By Dennis Hayes||
|May 26, 2005 09:00 AM EDT||
If you're one of the many who have VB6 code, you have three basic options: stay with VB6, convert to .NET, or rewrite from scratch. In this article, we will look at converting VB6 code to VB.NET and C#. I'll discuss when it makes sense to convert versus staying with VB6 or rewriting from scratch. I will cover what converts well and what does not, different ways to do the conversion, how to get code ready to convert, and handling issues after the conversion.
First, let's get an executive-level overview of where VB6 and VB.NET are at in their life cycles. Note that when I mention VB.NET in this article, I mean all three versions (2002, 2003, 2005). When I talk about a specific version, I will specify the version (such as VB.NET 2002). With the advances in VB.NET 2003, as well as its compatibility with VB.NET 2002, there is little reason to migrate to, or stay with, VB.NET 2002. VB.NET 2005 is still an unstable beta, so the focus here will be on converting to VB.NET 2003.
For those of you who wish to stay with VB6, the key fact is that VB6 developer licenses are perpetual, so developers who have licenses can continue to develop in VB6 for as long as they wish. However, VB6 was released in January 1999 and is approaching six years of age. As a result, it is near the end of its life (VB 1.0 was originally released in 1990). VB6 no longer exists as a stand-alone product - mainstream support ends in about six months - and all support will end three years after that. Currently, to get a new VB6 license, you must either buy VB.NET and then request a VB6 downgrade disk (for about $20), or get an MSDN subscription and download it from the archives. However, I wouldn't be surprised to see these dates extended.
VB6 can be a viable option for small- to medium-sized programs with limited lifespans, for several years to come. But for large, long-term projects that will need to be maintained for a number of years, VB6 is rapidly becoming a non-option.
VB.NET was in widespread beta, with some commercial applications shipping in 2001. Release 1.0 came in 2002 and version 1.1 showed up in 2003. VB.NET is clearly ready for primetime. As a bonus, Mainsoft Corp., Mono, and Portable.NET are preparing to take VB.NET code cross-platform.
VB.NET can be cheap; many VB6 developers are MSDN members and already have access to VB.NET. The stand-alone VB.NET product is about $110, and adventuresome folk can download a free copy of VB.NET 2005 that contains the upgrade wizard at lab.msdn.microsoft.com/vs2005/get/default.aspx. A DVD (or CD) of the VS2005 Enterprise version beta can be ordered for a shipping and handling fee from the same Web page. Serious developers and corporations will typically have one of the more expensive MSDN subscriptions and access to all of this and more.
If you have VB6 code, your main choices are to stay with VB6, convert the code to VB.NET or C#, or rewrite the code from scratch in VB.NET, C#, or Java. If you plan to rewrite in Java, you are probably reading the wrong article (and probably the wrong magazine; may I suggest our fine sister publication JDJ).
Whether or not to convert a program is always a case-by-case decision, driven by several competing factors such as the quality of the original code, cost, programmer availability, customer base, etc. On one hand, the only clear case where not going through at least a trial conversion would make sense is if the product is at the end of its life, with only bug fixes being implemented, and no plans for future versions. On the other hand, few large VB6 programs will convert to VB.NET without some significant rewriting. In almost all cases, I think going through at least a quick "probe" conversion is a good exercise for almost all projects - even if the converted code is not used, some valuable lessons will be learned.
Although the focus of this article will be on VB6 to VB.NET conversions, those of you moving to C# or looking at a complete VB.NET rewrite can still benefit from a conversion to VB.NET. For those of you looking at moving to C#, there are several tools (we will take a quick look at a couple of them later) that convert VB.NET to C# (and back), so it makes sense to convert to VB.NET as a step on the way to C#. If you're planning to do a complete rewrite to either VB.NET or C#, you can use the VB.NET conversion wizard to get a head start. In most programs, there are blocks of code that implement algorithms or business logic. These blocks of converted code can be pasted into a new project, speeding development for those choosing to do a complete rewrite.
Also consider that there are different levels and methods of conversion. If you have an ActiveX control written in VB6, a true conversion would be to rewrite it as a WinForm control in VB.NET. A better option might be to wrap the control in a .NET wrapper and use it from .NET while converting and testing. Shipping a VB6 ActiveX control with a .NET application can complicate the install because the VB runtime and associated files must also be installed. This is the same installation that is required if the control is installed with a VB6 application, but it is obviously more complex than the simple XCopy install of pure .NET applications.
Another way in which this ActiveX wrapper trick can be used is on forms that do not convert well, regardless of the reason. If the form can be moved to a separate project that was created as an ActiveX control project, the resulting ActiveX control can be added to a replacement form in VB6 or to a VB.NET project. Any form that can be separated from the rest of the program in this manner can be converted to an ActiveX control and used from .NET using .NET's built-in interop capabilities. In addition, we will see that most simple DLLs can be easily used directly from .NET.
In converting from VB6 to VB.NET 2003, three areas will be looked at: general VB6 code, ADO database code, and ASP Web page code. In this article, I concentrate on using the upgrade wizard to convert general VB code to VB.NET. In the future articles, I will finish general conversion issues, covering ADO, ASP, C#, and VB.NET 2005.
Before We Even Start
Remove dead code; you cannot have trouble with code you do not convert. Remove variables that are never used and subroutines that are never called. I converted one application that was large enough to have a number of associated programs, such as configuration programs, format converters, upgrade tools, and some ActiveX controls. Most of these utilities shared header files (WIN32 API declare statements and user type definitions) with the main application, but most of these programs only used a few of the functions in the headers. Other applications did not use anything in some of the headers. By removing the unused files and functions from the project, I was able to convert all the utilities much quicker. This allowed some functionality to be shown quickly, and provided the experience needed to tackle the main application.
When people aren’t talking about VMs and containers, they’re talking about serverless architecture. Serverless is about no maintenance. It means you are not worried about low-level infrastructural and operational details. An event-driven serverless platform is a great use case for IoT. In his session at @ThingsExpo, Animesh Singh, an STSM and Lead for IBM Cloud Platform and Infrastructure, will detail how to build a distributed serverless, polyglot, microservices framework using open source tec...
Jun. 27, 2016 08:30 PM EDT Reads: 322
IoT offers a value of almost $4 trillion to the manufacturing industry through platforms that can improve margins, optimize operations & drive high performance work teams. By using IoT technologies as a foundation, manufacturing customers are integrating worker safety with manufacturing systems, driving deep collaboration and utilizing analytics to exponentially increased per-unit margins. However, as Benoit Lheureux, the VP for Research at Gartner points out, “IoT project implementers often ...
Jun. 27, 2016 07:45 PM EDT Reads: 342
Basho Technologies has announced the latest release of Basho Riak TS, version 1.3. Riak TS is an enterprise-grade NoSQL database optimized for Internet of Things (IoT). The open source version enables developers to download the software for free and use it in production as well as make contributions to the code and develop applications around Riak TS. Enhancements to Riak TS make it quick, easy and cost-effective to spin up an instance to test new ideas and build IoT applications. In addition to...
Jun. 27, 2016 05:15 PM EDT Reads: 356
Presidio has received the 2015 EMC Partner Services Quality Award from EMC Corporation for achieving outstanding service excellence and customer satisfaction as measured by the EMC Partner Services Quality (PSQ) program. Presidio was also honored as the 2015 EMC Americas Marketing Excellence Partner of the Year and 2015 Mid-Market East Partner of the Year. The EMC PSQ program is a project-specific survey program designed for partners with Service Partner designations to solicit customer feedbac...
Jun. 27, 2016 03:15 PM EDT Reads: 351
Machine Learning helps make complex systems more efficient. By applying advanced Machine Learning techniques such as Cognitive Fingerprinting, wind project operators can utilize these tools to learn from collected data, detect regular patterns, and optimize their own operations. In his session at 18th Cloud Expo, Stuart Gillen, Director of Business Development at SparkCognition, discussed how research has demonstrated the value of Machine Learning in delivering next generation analytics to imp...
Jun. 27, 2016 03:00 PM EDT Reads: 760
In his general session at 18th Cloud Expo, Lee Atchison, Principal Cloud Architect and Advocate at New Relic, discussed cloud as a ‘better data center’ and how it adds new capacity (faster) and improves application availability (redundancy). The cloud is a ‘Dynamic Tool for Dynamic Apps’ and resource allocation is an integral part of your application architecture, so use only the resources you need and allocate /de-allocate resources on the fly.
Jun. 27, 2016 03:00 PM EDT Reads: 1,159
It is one thing to build single industrial IoT applications, but what will it take to build the Smart Cities and truly society changing applications of the future? The technology won’t be the problem, it will be the number of parties that need to work together and be aligned in their motivation to succeed. In his Day 2 Keynote at @ThingsExpo, Henrik Kenani Dahlgren, Portfolio Marketing Manager at Ericsson, discussed how to plan to cooperate, partner, and form lasting all-star teams to change t...
Jun. 27, 2016 02:45 PM EDT Reads: 1,232
In his keynote at 18th Cloud Expo, Andrew Keys, Co-Founder of ConsenSys Enterprise, provided an overview of the evolution of the Internet and the Database and the future of their combination – the Blockchain. Andrew Keys is Co-Founder of ConsenSys Enterprise. He comes to ConsenSys Enterprise with capital markets, technology and entrepreneurial experience. Previously, he worked for UBS investment bank in equities analysis. Later, he was responsible for the creation and distribution of life sett...
Jun. 27, 2016 02:30 PM EDT Reads: 1,237
There are several IoTs: the Industrial Internet, Consumer Wearables, Wearables and Healthcare, Supply Chains, and the movement toward Smart Grids, Cities, Regions, and Nations. There are competing communications standards every step of the way, a bewildering array of sensors and devices, and an entire world of competing data analytics platforms. To some this appears to be chaos. In this power panel at @ThingsExpo, moderated by Conference Chair Roger Strukhoff, Bradley Holt, Developer Advocate a...
Jun. 27, 2016 12:00 PM EDT Reads: 847
Connected devices and the industrial internet are growing exponentially every year with Cisco expecting 50 billion devices to be in operation by 2020. In this period of growth, location-based insights are becoming invaluable to many businesses as they adopt new connected technologies. Knowing when and where these devices connect from is critical for a number of scenarios in supply chain management, disaster management, emergency response, M2M, location marketing and more. In his session at @Th...
Jun. 27, 2016 10:00 AM EDT Reads: 1,055
The cloud market growth today is largely in public clouds. While there is a lot of spend in IT departments in virtualization, these aren’t yet translating into a true “cloud” experience within the enterprise. What is stopping the growth of the “private cloud” market? In his general session at 18th Cloud Expo, Nara Rajagopalan, CEO of Accelerite, explored the challenges in deploying, managing, and getting adoption for a private cloud within an enterprise. What are the key differences between wh...
Jun. 27, 2016 09:30 AM EDT Reads: 899
A strange thing is happening along the way to the Internet of Things, namely far too many devices to work with and manage. It has become clear that we'll need much higher efficiency user experiences that can allow us to more easily and scalably work with the thousands of devices that will soon be in each of our lives. Enter the conversational interface revolution, combining bots we can literally talk with, gesture to, and even direct with our thoughts, with embedded artificial intelligence, wh...
Jun. 27, 2016 07:30 AM EDT Reads: 1,076
SYS-CON Events announced today that Bsquare has been named “Silver Sponsor” of SYS-CON's @ThingsExpo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. For more than two decades, Bsquare has helped its customers extract business value from a broad array of physical assets by making them intelligent, connecting them, and using the data they generate to optimize business processes.
Jun. 26, 2016 05:00 PM EDT Reads: 1,244
Cloud computing is being adopted in one form or another by 94% of enterprises today. Tens of billions of new devices are being connected to The Internet of Things. And Big Data is driving this bus. An exponential increase is expected in the amount of information being processed, managed, analyzed, and acted upon by enterprise IT. This amazing is not part of some distant future - it is happening today. One report shows a 650% increase in enterprise data by 2020. Other estimates are even higher....
Jun. 26, 2016 05:00 PM EDT Reads: 1,326
Internet of @ThingsExpo, taking place November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with 19th Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The Internet of Things (IoT) is the most profound change in personal and enterprise IT since the creation of the Worldwide Web more than 20 years ago. All major researchers estimate there will be tens of billions devices - comp...
Jun. 26, 2016 04:00 PM EDT Reads: 1,299
19th Cloud Expo, taking place November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA, will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud strategy. Meanwhile, 94% of enterpri...
Jun. 26, 2016 04:00 PM EDT Reads: 1,367
The 19th International Cloud Expo has announced that its Call for Papers is open. Cloud Expo, to be held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA, brings together Cloud Computing, Big Data, Internet of Things, DevOps, Digital Transformation, Microservices and WebRTC to one location. With cloud computing driving a higher percentage of enterprise IT budgets every year, it becomes increasingly important to plant your flag in this fast-expanding business opportuni...
Jun. 26, 2016 12:00 PM EDT Reads: 1,315
Internet of @ThingsExpo, taking place November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with the 19th International Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world and ThingsExpo Silicon Valley Call for Papers is now open.
Jun. 26, 2016 12:00 PM EDT Reads: 1,153
There is little doubt that Big Data solutions will have an increasing role in the Enterprise IT mainstream over time. Big Data at Cloud Expo - to be held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA - has announced its Call for Papers is open. Cloud computing is being adopted in one form or another by 94% of enterprises today. Tens of billions of new devices are being connected to The Internet of Things. And Big Data is driving this bus. An exponential increase is...
Jun. 26, 2016 12:00 PM EDT Reads: 1,376
Cognitive Computing is becoming the foundation for a new generation of solutions that have the potential to transform business. Unlike traditional approaches to building solutions, a cognitive computing approach allows the data to help determine the way applications are designed. This contrasts with conventional software development that begins with defining logic based on the current way a business operates. In her session at 18th Cloud Expo, Judith S. Hurwitz, President and CEO of Hurwitz & ...
Jun. 25, 2016 03:00 PM EDT Reads: 1,652