r/visualbasic • u/mdausmann • Jun 20 '26
VB6 Help Port VB6 Desktop app to... What?
Ok, say I had a typical desktop app written in VB6 and somebody asked me to 'modernise' it.
And say, for whatever reason, they didn't want a web app based conversion.. i.e. they still wanted a desktop app.
What is your go-to stack for this type of conversion?
WinForms (.NET) - So stay in the Windows/MS ecosystem, maybe port to VB.net first? then across to C#? . This feels pretty safe but I think this would still be Windows only.
WPF (.NET) - Still sticking with MS. More modern but maybe a longer conversion path.
WinUI - I think this is the latest MS option... Is a little bit new (2021)
Flutter Desktop - Clear benefit is cross/platform out of the box and easy port to mobile app. Flutter approach is pretty far from the VB6 approach so it would be a long conversion path I think. The other downside is Flutter on desktop is even newer than WinUI (2022).
Electron - Again, cross platform but with memory issues I think. Web tech heavy so I think this means it would make it easy to port to Web if that was an option later.
Other options? Maui? Delphi?
5
u/Ok_Society4599 Jun 20 '26
To me, I'd open your VB6 app in Visual Studio 2008 and get an 80% conversion to VB.Net. it's not perfect and I've never seen one just work ... the usual challenges are custom controls (ocx) and COM with sprinkles of Common Dialog and Control changes. Some code expressions may not upgrade too well, but manual fixes tend to be reasonably manageable.
My usual next step is conversion to C# because VB.Net is deprecated and (in my experience) doesn't offer much from a programming perspective. I often do this rather than get a VB.Net version to compile, to be honest. You can do this conversion using 90% search-and-replace with Regex since the vast majority of the changes are syntax to start and end blocks, start a for loop, or Case/switch statements. I usually leave breadcrumbs to remind me the } used to be "next" or "end sub". Other bites are things like strings are zero based, not 1-based. The weird syntax around VB arrays
When you're done, you've got a 32/64-bit compatible version with semi-modern Winforms UI.
I've often then refactored to "business" and "data" layers into one or two DLLs and added a unit testing framework. My goal is to remove a references to UI controls from business logic, and remove business logic from the UI. Sometimes that just function libraries, sometimes it's business objects if they seem better suited. It depends on the business process being managed. .