How to convert VB to C#: Case study
With Microsoft having discontinued Visual Basic, many organizations consider transferring legacy software. Modern technologies and approaches, for example converting VB to C#, allow companies remain competitive and adaptable to the ever-changing market.
Working on one of our projects, we assisted a corporation in modernizing their outdated legacy software. Having rewritten some slow AutoCAD functions and implemented modern approaches – converting VB to C# – we helped our client significantly minimize license costs for 75% of end-users and provided for streamlined business growth.
Why consider moving VB to C#
Visual Basic is a suiting language to build simple applications, but it’s not the cool kid down the block anymore. If you’re currently using system-specific applications running on Visual Basic, and your software developer suddenly quits, you will be stressed to find suitable candidates.
“Going forward, we do not plan to evolve Visual Basic as a programming language,”– states Microsoft.
When Microsoft publicly announced its new business strategy for VB, they officially stated that it is used by “thousands” of software professionals compared to “millions” that use C# and other popular technologies. Their intention was to lead C# for cloud, website and mobile development, while VB would be utilized by software specialists for Windows desktop development.
The reasons are clear-cut:
- Visual Basic is a so-called proprietary programming language, which means VB-based applications cannot easily be transferred to other operating systems
- Visual Basic gives way to other programing languages like C#, which has better declaration of arrays – with C#, you can easily initialize an array of structures at a declaration time
Core goals and challenges
In 2019, Abto Software has started the cooperation with a leading manufacturer in the machinery industry. With over 16 years in the information and technology market and expertise in providing legacy modernization, we migrated several applications, all written in different programming languages.
The project’s main goal was building a custom, state-of-the-art toolkit to design different types of products.
The project’s main challenges concerned the following matters:
- The installed AutoCAD plugin initially written in VBA and LISP caused problems during installation
- Each new AutoCAD version brought issues to the installed plugin
- Some parts of the legacy functionality stopped working
- Although the AutoCAD plugin was still supporting VBA, it was not available by default and required separate download and installation
With the required knowledge and experience, our team has finished the project within deadlines and budget. We migrated several applications providing for accelerated flexibility and scalability.
By leveraging extensive expertise, in particular:
Thorough analysis and roadmapping
After conducting thorough investigation of the AutoCAD functionality, we detected the parts causing hazard and created a roadmap comprising the following processes:
1. Convert software from VB to .NET in C#
- Converted the legacy software from VB to .NET in C#
- Removed dependencies on the AutoCAD plugin
WPF UI was implemented by utilizing MVVM Light.
2. Extend functionality
We provided additional functionality to cover the needs of users approaching more sophisticated tasks.
3. Build modules for both advanced and beginner users
- Special modes for advanced users to execute additional commands
- Simple wizards for inexperienced users to cover common workflows
4. Separate the common code
We successfully separated the common code to ensure:
- Correct behavior
- Reliable synchronization
5. Provide convenient reading, saving, and exporting
The solution was integrated with the third-party library WoutWare CadLib to allow:
- *.dwg and *.dxf reading and saving
- PDF export
VB6 to .NET migration: Strategies, challenges, actuality
Why approach VB6 to .NET migration?
Learn more from our .NET specialists.
Rewriting slow AutoCAD functions
The most labor-intensive part was to rewrite slow AutoCAD functions:
1. Automatic conversion
The algorithm producing polylines was rewritten in three simple steps:
- First, VBA was converted to VB6
- Second, VB6 was converted to VB.NET with Visual Studio 2003
- Lastly, VB.NET was converted to C#
Having conducted partial conversion, we proceeded with the manual migration of several complex algorithms, which couldn’t be rewritten with an automatic converter.
2. Manual conversion
Moving further, our team:
- Used the BOUNDARY command, but have soon realized it was lacking precision
- Replaced the BOUNDARY command and implemented a more precise algorithm
- Utilized the same algorithm in both standalone application and plugin
3. Tan Tan Radius replacement
We replaced the implemented AutoCAD Circle Tan Tan Radius function and automated polyline generation. After automating this routine, we replaced the native AutoCAD functions OFFSET, TRIM, EXPLODE, PEDIT.
4. Reporting enhancement
Reporting included finding appropriate zoom levels, annotating individual polyline curves, finding templates. These routines are now done with a single mouse click.
5. Unit testing
Unit testing allowed to quickly identify risky cases when the new improvements were breaking file support. What’s more, unit tests also helped correctly handle other situations.
How we can help
Abto Software, Microsoft Gold Certified Partner, can cover legacy modernization no matter the complexity. From assessment and planning to implementation, our team does everything to eliminate legacy limitations and boost business growth.
Our services perfectly combine proven methodologies, best practices, and innovation.
- Custom desktop, web and mobile development
- Legacy migration and optimization
- Business consulting and analysis
- Project management
- Artificial intelligence
- Computer vision
- Data Science
- And other advanced technology
- Reduced time and cost
Properly maintaining and supporting outdated technology requires comprehensive, industry-specific expertise. Delaying migration, you will face troubles finding candidates with the necessary knowledge and experience, which might increase time and cost.
By hiring a software development company with extensive modernization expertise, you can allocate resources more wisely.
- Increased competitiveness
Outdated technology leads to unjustified expenses, security vulnerability, complicated debugging, and more. Delaying modernization causes multiple complex issues decreasing overall business competitiveness.
By approaching a software development firm that has modernization expertise, you can eliminate potential reputational and financial damage.
Along with multiple respective business benefits:
- Improved security
- Better compatibility, flexibility, scalability, and integration
- Reduced risks
- Increased productivity