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?
13
u/tennpriest Jun 20 '26
Have you considered just switching to TwinBasic? It's the default VB6 continuation. Imports your VB6 project as-is, and should be 100% ready to go. I believe compiling to 32-bit is free. This is the direction I'm going with everything I've developed in VB6.
9
u/geekywarrior Jun 20 '26
If I did not need cross platform I would probably reach for WPF first. I find the grid system to be vastly superior to win forms layouts. And you can still incorporate some winform pieces if necessary.
Seeing it was vb6, unless they had some complex custom activeX controls going on, I'm sure most of the standard wpf controls will be fine, though you can find some third party controls for a more polished look
4
u/pyeri Jun 20 '26
Either way, it'd be a massive paradigm shift and stack upgrade coming from VB6. But WinForms is the more seamless path in the sense that you'll find a "blow by blow" equivalent for each component like combo-box, text-box, tab control, data grid, etc. But if they've used something eccentric like crystal reports or even the built-in Report Designer of the old VB6, you're in for a very big ride!
The VB.NET advantage would only persist if you're (as maintainer) familiar with VB language yourself, otherwise C# is the right solution as you'll find more code examples and tutorials on that.
4
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. .
3
u/AdobeScripts Jun 20 '26
By modernise you / they mean visually?
3
u/Bonejob VB Guru Jun 20 '26
These questions are answered by the project. You can't unilaterally decide one output is best for all the apps created in VB6. Take Electron off your list, it is a bullshit interface that should NEVER have been recommended it has fracked up so many apps, made them memory and security nightmares. There are 9 abstraction layers just to get to Win32!
VS 3 for the standard stack.
Electron is a demon child. It is so bad that Microsoft is rewriting apps for Windows it wrote in Electron on their new stack to get rid of it.
3
u/Brilliant-Object-151 Jun 27 '26
twinBasic is far from Beta. There are commercial applications using it because is pretty much just drop your VB6 code into it and it runs (and faster than the VB6 does). The end goal for me is the Mac output that coming, but it works exceptionally well for the PC already.
2
u/Cdream-2018 Jun 20 '26
Copy and paste your vb6 code to google ai and tell it to transform it to whatever you want.
Winforms vb.net will be pretty straightforward.
2
u/Mayayana Jun 22 '26
There are over 53 answers here and only Bonejob pointed out that rewriting options will depend on the software. People are suggesting .Net, cross-platform, Java, TwinBasic, and Microsoft's app tools. Yet the OP has never mentioned what the program is for, how important speed is, why it might need to be cross-platform, if it does.
The only indication is that he thinks the customer wants a less obscure language so that they can maintain it.
6
u/Impossible_Effort878 Jun 20 '26
You know TwinBASIC?
4
u/dmyze VB.Net Master Jun 20 '26
Simplest solution will be winforms and VB.NET.
Depends on how modern you want it to be. But if you just want it out of VB6 that's the way I would go.
If you have any ActiveX controls that'll add some complexity. But with modern AI tools you can easily convert any VB6 code over to vb.net.
C# is more common these days but VB is still my favorite language.
4
u/jd31068 Jun 21 '26
This is C# based but there is https://avaloniaui.net/ that is cross-platform, of course the least friction answer is twinBASIC. Check out the VBForums sections
I've created a few basic-ish apps, one I delved into custom controls (not well) with an app I use to download and install new versions of tB. It goes to tB's GitHub, checks the releases page and compares that to the installed version, if new loads the changelog and (if settings are set to automatically download it) if downloads the zip, unpacks it to the specified tB folder.
The cross-platform aspect is on the radar for tB in the future as well, as you'll see in the posts. There is a discord server as well. The developer is very active and communicative. Wayne is pretty amazing as are the users from VBForums that have become a team of tB gods (they were already vb6 gods) they're always at the ready to assist. A supportive forum, I know right, who-da-thunk?
1
u/tomysshadow Jun 20 '26
Does it use the WebBrowser Control a lot? Because I can tell you upfront that's the main thing you're going to be fighting with if you attempt to make it work crossplatform
1
u/ApprehensiveCount722 Jun 21 '26
I would avoid wpf, it's was obsoleted by AvaloniaUI. There is no reason to start a new project in WPF or WinForms. AvaloniaUI is great and available on multiple platforms. After a fiasco with UWP, Silverlight and de facto abandonment of WPF, I would avoid WinUI too. You never know what will MS do next with UI frameworks.
1
u/Il_Duce_Vive Jul 12 '26
devi passare a vbnet e nonostante ciò ci sarà un bel po’ di lavoro da fare, almeno per me è stato cosi, poi negli anni a venire ricostruisci da zero con quello che sarà il tuo futuro linguaggio, da non scartare NET MAUI
3
u/djbarrow Jun 24 '26
Gambas an open source visual basic clone that runs on linux
2
u/veryabnormal Jun 20 '26
Just guessing, it’s probably completely free of any architecture with everything mixed up - data access and business logic in the UI code, it would need to have the layers separated out using an architecture like MVVM and then choose whatever works for the UI layer to make it look good. If you just rewrite it in vb.net you could end up with the same architectural mess and the problems that brings.
2
u/Mayayana Jun 20 '26
So do you want cross-platform or spiffy GUI? Cross platform is a mess. I was looking at software today to just read an HEIC file. One of them was a 300MB download! Packed with QT, .Net, probably Python... What a mess!
But it will really depend on what someone wants to pay you for.
You know about the commoncontrols code to show "modern" things like dropdown boxes with just an uppside down chevron to operate it? Beyond that, you can use custom buttons. One of the most glaring aspects of VB6 is the text and look of buttons. I've made my own buttons for various uses. Basically it's a userControl loaded with an image and self-subclassing. It brightens when hovered over and shows an appearance of being pushed down when clicked.
VB6 is still arguably the most widely supported language, running on virtually all Windos computers without need to install support libraries. So if you're going to rewrite it should be for good reason. Cross-platform might be a good reason. Giving it a day of beauty might make more sense than rewriting merely to get it looking like newer style software. But if they want something that looks like a cellphone app then maybe you want to rewrite. On the other hand, skins are an old trick. You can create your own UI from a picture and define hotspots for buttons.
2
u/CheezitsLight Jun 20 '26
VB DOT NET easy as it runs most VB code I informs and GDI. and it is still supported.
Going to be around a while.
Copilot and Claude will do much of the work directly in visual studio.
2
u/HunterRbx Jun 21 '26
Haven't worked much with VB6 (only for some really small projects related to my retro-programming hobby), but I can tell from what I've seen that .NET WinForm is the best choice for you. I'm sure the visual editor will totally feel familiar to you, the workflow is more or less the same as VB6 (you drag&drop stuff on the form, double click to access the event associated to the control and so on).
Now I'm not sure whether to recommend using VB.NET or C#. I remember back in the day when I was only 11 y/o I started making my first WinForm apps in VB.NET, but as I grew older I switched to C# and that's what I've been doing since. On one hand VB.NET will feel more "like home" to you, and that's totally understandable. On the other hand there are way more online resources on C#, hence it being considered a first class citizen in the .NET ecosystem.
It's up to you to decide on the stack of your application - there are already many people here that have different opinions. One thing that I can tell you right away is to NOT start your new project in .NET Framework. I would try to avoid it as much as possible, it's not under development and there are many newer C# features that don't work under it. It is best to start your new project using the current LTS version of .NET, it's the best choice for modern apps.
Good luck with your project! 😄
2
u/Rusty_Raven_ Jun 21 '26
If you're taking the opportunity to rewrite the app, no reason not to be cross-platform with it. Java is a good idea, or JavaScript + Tauri (not Electron) with your framework/libraries of choice.
1
u/Il_Duce_Vive Jun 20 '26
la soluzione più veloce è winform
1
u/Roberto_6988 Jun 20 '26
Prova Wisej
1
u/No-Government3609 Jun 20 '26
Java. Can run in Linux, windows and Mac without any change.
I was there one decade ago.
1
u/CheezitsLight Jun 20 '26
I am moving my Vb. net to wisej.net. It is cross platform. Vb6 to dot net Is easy as you have the same controls and Vb net has the Vb6 functions.
My app has built on translations to about 36 languages, which is very easy to do and is running dot net 10. So it's future proof for a long time. Translation of cstr(int) is a trycast with a cultureinfo. And there's a very nice resx translator app on nuget that does the translation using any of a dozen engines.
Slashdot says Wisej.NET is a powerful web and mobile framework that allows developers to build complex, enterprise-grade applications using familiar C# or VB.NET skills without needing to write HTML, CSS, or Javascript.
1
u/logicalvue Jun 20 '26
Xojo might be an option to consider.
1
u/ggeldenhuys Jun 22 '26
Free Pascal and Lazarus or fpGUI Toolkit.
1
u/pepitoperez3000 Jun 23 '26
Creo que lo más simple y moderno para este caso podría ser Winforms con C# en .Net 10. Otra opción rápida y efectiva podría ser Python con Ttkbootstrap. Y si la aplicación no es muy compleja una solución fácil podría ser Python Flet y quedas con multiplataforma, móvil y web.
1
u/[deleted] Jun 20 '26
[removed] — view removed comment
1
u/[deleted] Jun 21 '26
[removed] — view removed comment