|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.
SYS-CON Events announced today that Cloud Academy will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Cloud Academy is the industry’s most innovative, vendor-neutral cloud technology training platform. Cloud Academy provides continuous learning solutions for individuals and enterprise teams for Amazon Web Services, Microsoft Azure, Google Cloud Platform, and the most popular cloud computing technologies. Ge...
Mar. 23, 2017 11:30 PM EDT Reads: 4,328
SYS-CON Events announced today that Loom Systems will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Founded in 2015, Loom Systems delivers an advanced AI solution to predict and prevent problems in the digital business. Loom stands alone in the industry as an AI analysis platform requiring no prior math knowledge from operators, leveraging the existing staff to succeed in the digital era. With offices in S...
Mar. 23, 2017 11:30 PM EDT Reads: 673
"My role is working with customers, helping them go through this digital transformation. I spend a lot of time talking to banks, big industries, manufacturers working through how they are integrating and transforming their IT platforms and moving them forward," explained William Morrish, General Manager Product Sales at Interoute, in this SYS-CON.tv interview at 18th Cloud Expo, held June 7-9, 2016, at the Javits Center in New York City, NY.
Mar. 23, 2017 10:15 PM EDT Reads: 3,259
With billions of sensors deployed worldwide, the amount of machine-generated data will soon exceed what our networks can handle. But consumers and businesses will expect seamless experiences and real-time responsiveness. What does this mean for IoT devices and the infrastructure that supports them? More of the data will need to be handled at - or closer to - the devices themselves.
Mar. 23, 2017 07:15 PM EDT Reads: 4,283
DevOps is often described as a combination of technology and culture. Without both, DevOps isn't complete. However, applying the culture to outdated technology is a recipe for disaster; as response times grow and connections between teams are delayed by technology, the culture will die. A Nutanix Enterprise Cloud has many benefits that provide the needed base for a true DevOps paradigm.
Mar. 23, 2017 06:00 PM EDT Reads: 1,296
My team embarked on building a data lake for our sales and marketing data to better understand customer journeys. This required building a hybrid data pipeline to connect our cloud CRM with the new Hadoop Data Lake. One challenge is that IT was not in a position to provide support until we proved value and marketing did not have the experience, so we embarked on the journey ourselves within the product marketing team for our line of business within Progress. In his session at @BigDataExpo, Sum...
Mar. 23, 2017 04:15 PM EDT Reads: 2,453
The taxi industry never saw Uber coming. Startups are a threat to incumbents like never before, and a major enabler for startups is that they are instantly “cloud ready.” If innovation moves at the pace of IT, then your company is in trouble. Why? Because your data center will not keep up with frenetic pace AWS, Microsoft and Google are rolling out new capabilities In his session at 20th Cloud Expo, Don Browning, VP of Cloud Architecture at Turner, will posit that disruption is inevitable for c...
Mar. 23, 2017 03:45 PM EDT Reads: 1,765
SYS-CON Events announced today that Telecom Reseller has been named “Media Sponsor” of SYS-CON's 20th International Cloud Expo, which will take place on June 6–8, 2017, at the Javits Center in New York City, NY. Telecom Reseller reports on Unified Communications, UCaaS, BPaaS for enterprise and SMBs. They report extensively on both customer premises based solutions such as IP-PBX as well as cloud based and hosted platforms.
Mar. 23, 2017 03:30 PM EDT Reads: 1,712
SYS-CON Events announced today that Ocean9will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Ocean9 provides cloud services for Backup, Disaster Recovery (DRaaS) and instant Innovation, and redefines enterprise infrastructure with its cloud native subscription offerings for mission critical SAP workloads.
Mar. 23, 2017 03:30 PM EDT Reads: 1,598
SYS-CON Events announced today that Cloudistics, an on-premises cloud computing company, has been named “Bronze Sponsor” of SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Cloudistics delivers a complete public cloud experience with composable on-premises infrastructures to medium and large enterprises. Its software-defined technology natively converges network, storage, compute, virtualization, and management into a ...
Mar. 23, 2017 02:30 PM EDT Reads: 1,460
SYS-CON Events announced today that CA Technologies has been named “Platinum Sponsor” of SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY, and the 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. CA Technologies helps customers succeed in a future where every business – from apparel to energy – is being rewritten by software. From ...
Mar. 23, 2017 02:15 PM EDT Reads: 1,191
SYS-CON Events announced today that T-Mobile will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. As America's Un-carrier, T-Mobile US, Inc., is redefining the way consumers and businesses buy wireless services through leading product and service innovation. The Company's advanced nationwide 4G LTE network delivers outstanding wireless experiences to 67.4 million customers who are unwilling to compromise on ...
Mar. 23, 2017 12:45 PM EDT Reads: 1,693
SYS-CON Events announced today that Addteq will exhibit at SYS-CON's DevOps Summit at Cloud Expo, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Addteq specializes in creating innovative solutions to solve business processes through the use of DevOps automation. Addteq was founded on the firm belief that automation is essential for successful software releases. Addteq's products and services are centered around the fundamental approach of understanding the pr...
Mar. 23, 2017 12:30 PM EDT Reads: 2,763
Keeping pace with advancements in software delivery processes and tooling is taxing even for the most proficient organizations. Point tools, platforms, open source and the increasing adoption of private and public cloud services requires strong engineering rigor - all in the face of developer demands to use the tools of choice. As Agile has settled in as a mainstream practice, now DevOps has emerged as the next wave to improve software delivery speed and output. To make DevOps work, organization...
Mar. 23, 2017 12:30 PM EDT Reads: 1,175
SYS-CON Events announced today that SoftLayer, an IBM Company, has been named “Gold Sponsor” of SYS-CON's 18th Cloud Expo, which will take place on June 7-9, 2016, at the Javits Center in New York, New York. SoftLayer, an IBM Company, provides cloud infrastructure as a service from a growing number of data centers and network points of presence around the world. SoftLayer’s customers range from Web startups to global enterprises.
Mar. 23, 2017 12:30 PM EDT Reads: 1,085
SYS-CON Events announced today that Infranics will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Since 2000, Infranics has developed SysMaster Suite, which is required for the stable and efficient management of ICT infrastructure. The ICT management solution developed and provided by Infranics continues to add intelligence to the ICT infrastructure through the IMC (Infra Management Cycle) based on mathemat...
Mar. 23, 2017 09:30 AM EDT Reads: 2,546
"I think that everyone recognizes that for IoT to really realize its full potential and value that it is about creating ecosystems and marketplaces and that no single vendor is able to support what is required," explained Esmeralda Swartz, VP, Marketing Enterprise and Cloud at Ericsson, in this SYS-CON.tv interview at @ThingsExpo, held June 7-9, 2016, at the Javits Center in New York City, NY.
Mar. 23, 2017 08:00 AM EDT Reads: 3,787
The buzz continues for cloud, data analytics and the Internet of Things (IoT) and their collective impact across all industries. But a new conversation is emerging - how do companies use industry disruption and technology enablers to lead in markets undergoing change, uncertainty and ambiguity? Organizations of all sizes need to evolve and transform, often under massive pressure, as industry lines blur and merge and traditional business models are assaulted and turned upside down. In this new da...
Mar. 23, 2017 08:00 AM EDT Reads: 3,320
Web Real-Time Communication APIs have quickly revolutionized what browsers are capable of. In addition to video and audio streams, we can now bi-directionally send arbitrary data over WebRTC's PeerConnection Data Channels. With the advent of Progressive Web Apps and new hardware APIs such as WebBluetooh and WebUSB, we can finally enable users to stitch together the Internet of Things directly from their browsers while communicating privately and securely in a decentralized way.
Mar. 23, 2017 03:00 AM EDT Reads: 5,516
SYS-CON Events announced today that HTBase will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. HTBase (Gartner 2016 Cool Vendor) delivers a Composable IT infrastructure solution architected for agility and increased efficiency. It turns compute, storage, and fabric into fluid pools of resources that are easily composed and re-composed to meet each application’s needs. With HTBase, companies can quickly prov...
Mar. 23, 2017 02:15 AM EDT Reads: 2,453