Application & Data Migration Blog Posts | Mobilize.Net

VBUC 10.3: A Sneak Peek! Your VB6 Code is about to Get a Sweet Upgrade

Written by Cheyenne Sokkappa | Oct 28, 2024 11:10:37 PM

Tired of your VB6 code looking like it’s from the Jurassic era? VBUC 10.3 just released and it’s bringing the 🔥 to modernize that ancient codebase. 

This is the official sneak peek, so be sure to be one of the first to download it and try it out. The official announcement and release will be on November 12th at .NET Conf. 

Let’s break it down:

Embrace the Future with .NET 9

You heard it right. You can now upgrade your VB6 code directly to .NET 9. This means tapping into the latest features and performance boosts from the .NET world. Remember, you’ll need Visual Studio 2022 to use .NET 9.

Curious about updating to .NET 8 or .NET 9? Check out our blog post to help you decide!

Also watch this demo to see a VB6  application migration with VBUC 10.3: 

 

Pattern Matching Magic: No More Spaghetti Code

We’ve seriously leveled up our pattern matching game. VBUC 10.3 now supports more pattern conversions, resulting in cleaner, more readable code. This is especially helpful when you're targeting .NET 6 or higher. 

Here’s a quick before and after to show what we mean:

VB6 Code

Public Sub IsLengthMultipleOfThree2(shape As Object)
	If TypeOf shape Is Rectangle Then
		With shape
			If	.Length Mod 3 = 0 Then
				Debug.Print "Var pattern Case 2: PASSED"
			End If
		End With
	End If
End Sub

 

Old C# Code converted from previous VBUC versions:

Internal static void IsLengthMultipleOfThree2(object shape) 
{ 
  Rectangle shapeTyped null;
  if (shape is Rectangle) 
   { 
      shapeTyped = (Rectangle)shape; 
      if (Convert.ToInt32(shapeTyped.Length) % 3 == 0) 
        { 
           Debug.WriteLine("Var pattern Case 2: PASSED"); 
        } 
    } 
}

 

New Improved C# Code from VBUC 10.3:

Internal static void IsLengthMultipleOfThree2(object shape) 
{ 
       if (shape is Rectangle shapeTyped) 
         { 
             if 	(Convert.ToInt32(shapeTyped.Length) % 3 == 0) 
               { 
                    Debug.WriteLine("Var pattern Case 2: PASSED"); 
               } 
          } 
}

 

See? Much cleaner! And this is just one example. We’ve got more pattern matching goodness waiting for you in the release notes.

Want to dive deeper into pattern matching? Microsoft’s got you covered:

https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/functional/pattern-matching

.NET Framework? We Got You (Mostly)

We haven’t forgotten about you .NET Framework folks. Visual Studio 2022 is kind of picky with 32-bit assemblies, but we’ve got a workaround. Thanks to some new VS wizardry, you can dodge those compatibility issues. VBUC will point you in the right direction.

Word to the wise: This workaround isn’t foolproof so back up your project before you pull the trigger. Check out this repo to learn more: https://github.com/dotnet/winforms/blob/main/docs/designer/designer-selection.md

NuGet Tooltips: No More Guessing Games

When you’re configuring upgrade options for .NET 6 or higher, you’ll most likely come across some NuGet package dependencies. Now, you’ll get some sweet tooltips explaining those dependencies, making your upgrade process even smoother.

Other SUPER Useful Updates

We’ve been busy fine-tuning other stuff to make your migration better:

  • Grids mapping: Grids are way easier to upgrade now
  • Microsoft mappings: Better compatibility with Microsoft libraries
  • Helpers: Our helper classes are even more helpful (duh).

Ready to ditch VB6?

Head over to the VBUC trial and grab the latest version.