|
My experience is to create the new dotNet VB application from scratch. Use the VB6 source as a guide to what needs to be done. In some cases, I discovered that if I copy/paste the VB6 source into the project and then fix that source it worked wonders.
Gotchas:
- File IO - classic VB file handling is there, but using the new StreamReader and StreamWriter classes are far more efficient
- Event handlers, but at least VB.Net makes these explicit in the code. The order of event firing is different from VB6.
- Error handling: You can leave in the VB6 error handling but I strongly recommend you switch to the Try Catch Finally End Try constructs. I have a few short Subs and Functions where I legitimately use On Error Resume Next, but I document why I'm using this construct.
|
|
|
|
|
look at this post, it may give your ideas...
diligent hands rule....
|
|
|
|
|
You are better off leaving the existing application as VB6 and just do the change to the database layer, VB6 still works perfectly and will continue to do so for a long time.
Then just develop new features in .net when required.
We spent about 5 man years converting one of our applications to VB.Net and now its just as (not)supported by Microsoft as VB6.
|
|
|
|
|
Interesting answer. Really depends on a system analysis but you could be right. That said, VB6 is slated to possibly bite the dust in 10 or so years. Better long-term planning might be to gradually move it to some other platform. It's pretty easy to maintain DB compatibility with multiple platforms.
I don't see VB.net "just as not supported by MS" at all. I'm not saying I wouldn't choose something different, but VB support in VS22 seems to be pretty solid.
|
|
|
|
|
Member 15966771 wrote: VB6 still works perfectly and will continue to do so for a long time. It works, but that's all you can say about it.
Development and installation are a pain compared to modern solutions.
There also aren't too many developers who are willing to maintain and develop old VB6 applications, especially this one.
Besides, it works because it works for as long as it works.
If Microsoft pulls the plug, which they officially did in 2008, 15(!) years ago, this company can file for bankruptcy.
|
|
|
|
|
My company in a migration process from VB6 right now.
First things first. I don't know anything about you application so anything said down here may not be relevant.
My company have many million lines of code in VB6 and VBA compatible scripting language in the 3 main application. All of the are using the same core written in VB6.
We started the migration 2.5 years ago.
The process is like this.
1. Write a server side C# code and connect old UI to the new (C#, .NET Core 3.1, now upgraded to .NET 6).
1.1. Create core for "migrateable" components.
1.1.1. Connect server-side components to the old UI.
1.2. Migrate those components.
2. Create the new UI (C#, .NET 6, WPF).
2.1. Create core client-side components to show server-side components.
2.2. Migrate client-side UI components.
2.3. Create the tooling.
Many processes are parallel.
The smallest of the 3 main projects will be fully migrated at the end of this year.
The second one is planned to be ready at the end of next year.
Biggest biggest project is planned to be ready in 3 years (likely it will be 5 years).
The good news is that whatever is migrated is used by the customers already.
|
|
|
|
|
We had to do what you have to do big time. But with todays knowledge, I would like to encourage you questioning not only VB.Net vs C#. Depending on the charactor of the application, having a Web Application might be worth thinking about. You may want to have a look at JMIX which is a Java Framework on top of Spring Boot which gives you almost the easy of good old VB6. It gifts you with all the typical features of a modern application and the sample apps they offer could be a good starting point for modifying them to cover the functionality you need. No, I am not getting paid by those folks ... and I am still a strong supporter of VB (adopted it starting at Version 1.0). But now I heavily rely on JMIX and Windows getting independent from operating systems.
|
|
|
|
|
It's not going to be Java.
|
|
|
|
|
I have done this before, and how well it goes depends a lot on how good an engineer the person doing the conversion is.
Put enough time and planning into the design you want to go to. Use value engineering to determine what has the most value in the conversion process.
Don’t just replicate how the business rules are implemented. Migrate them using newer features where there is value in doing so.
The more the VB code used OO techniques (available in VB4 - VB6), the easier your job will be. Don’t try to replicate VB procedural programming design in C#.
Are your users desktop or browser? Determine the relative SDLC costs between WinForms and Blazor. Development time is less and performance is better with WinForms than any web-based GUI, but deployment costs may be higher. If you choose a web-based GUI, go with Blazor, not the Javascript-based approach. You’ll have less development time, better performance, and fewer headaches.
Don’t farm out the work to consultants, H1-B developers, or offshore developers. The end result will need a lot of repair and be more expensive to maintain.
Make sure to use someone in-house who is experienced in VB6 and in C#/.NET. A successful port will depend on deeply understanding both.
One last thing - VB6 can host C# DLLs, including user controls for the VB6 GUI, all written in pure C#, using COM Interop. I did this a while back and it works beautifully if the developer understands both C# COM Interop and how VB6 recognizes classes, interfaces, and events. That allowed us to migrate the app from VB6 to fully C# piece by piece, without wasted code.
Best of luck to you!
|
|
|
|
|
The engineer will be me and possibly an employee.
Best of the best, top notch, outstanding, brilliant, and the employee
MSBassSinger wrote: The more the VB code used OO techniques (available in VB4 - VB6) None whatsoever, the original programmer is known to use hidden controls to hold values because variables are too difficult
|
|
|
|
|
>Quote: Ideally, I'd rather just rewrite everything to web-based and cloud-ready .NET 6 applications, but I don't think we'll have the time nor money
Well, do it right the first time, or you will spend more time and more money to do the rewrite of the rewrite, or worse, the rewrite of the converted mess. Speaking from personal experience.....
|
|
|
|
|
Haha spoken as if OP has the power to make the decision between "Do it right" and "Do it right now". OP says VB6 dev is retiring. Therefore, there is a clock on the project and handoff.
I suspect the decision makers will be more likely to take the straightest path, not necessarily the wisest path.
I guess if I were involved, I would want it to be clear on whether this is purely a lift and shift migration project or a modernization project.
|
|
|
|
|
You answered your own question. Re-write.
Whether you need to go to web-based is a solution analysis; there are very valid reasons that desktop apps may provide a better solution than web-based or a hybrid mix of both may be the solution. We started with a large conversion that was going to be all desktop but ends up having some web-based modules where they made sense. Those are mostly parts having existing functionality on the web where some redesign can make the apps usable for in-house applications.
Convert? We moved Access to Postgres in the original VB6 code using ODBC as the first step. I wouldn't spend any time looking at "converters". First, none will do a decent job converting VB6 to VS22. The best you'd get is having to do a multistep conversion that will still leave a lot of broken functionality. If native printing was used in VB6, and I think most did, there can be a lot of work recreating documents to VS. Depending on the size and budget, that may be a place to look at a paid tool to do that function or play with an html2pdf in VS or as a web service, locally or cloud.
I would also look into the chance that some existing SaaS products can replace and integrate functionality.
If it's feasible, I would phase the transition by moving functions to your new platform while leaving others in VB6 for now. A lot of that depends on your client's ability to work with that and if you do end up moving to the web/cloud for some or all of the project. That serves to spread the money out over time which may help.
Depending on the codebase and your available resources, it could be a long road.
|
|
|
|
|
My company is currently taking our primary VB6 app (serves 100s of clients via RDS RemoteApps) and is converting to .net6 backend / vue frontend.
We first looked at all the tools that have been mentioned so far. We would have been happy to stay a desktop app if we could have converted from VB6.
In each case the use use of 3rd party controls (grids, drop downs, calendars, etc.) pretty much killed each of those options.
I am bringing it up as a warning, so you are aware of a possible impediment.
We could have attempted to convert and recoded to an updated front end, we chose not to after testing. For us the rough calculation didn't make sense to attempt to convert.
VB6 and Crystal Reports were often used together. You didn't mention if CR is part of your project.
We also use Crystal Reports for about 125 reports. About 15 of them are complex enough that we can't easily depracate CR. We came up with a way to host CR in container to save having a separate .net framework VM.
|
|
|
|
|
I had to migrate several projects from 6 to .NET back when. I found re-writing was pretty straightforward, the only thing that really slowed me up was not being able to use arrays of controls (which the VB6 projects used extensively). Worked out a work-around (which needed much more coding, but ran eventually). Good luck.
|
|
|
|
|
It's almost undoubtedly true that this code needs to be updated from an architectural standpoint as well. No disrespect to the soon-to-be retiree.
I've been in a situation where the code was crap, but nobody on the business side could explain how it was supposed to work. Thus, reworking it was more of, "well, good luck, hope you figure it out." Hope you're not in that situation, Sander.
|
|
|
|
|
Undoubtedly, this programmer is known to use hidden controls to hold values because variables are too difficult
agolddog wrote: Thus, reworking it was more of, "well, good luck, hope you figure it out." Hope you're not in that situation, Sander. I hope so too!
|
|
|
|
|
The company I work for has a large VB6 code base. I am the project lead for updating the main application to .NET 6 WPF/MVVM. In the span of about an year, one other developer and me have migrated about 75% of the old application.
I would definitely stay away from the automatic converter tools. While they do work, you will be left with the same mess of an application that you originally inherited. Now is the time to use modern design principals to develop a testable and extensible application. Not to mention multiple threads!
We also made the decision to keep the same look and feel as the VB6 application. Users have 20+ years of experience with the VB6 application, so giving them something completely new that works differently was met with major objections.
Instead of thinking "Run", think I have the opportunity to build something from scratch using a better architecture and use cutting edge technology. That sounds like a lot of fun to me.
modified yesterday.
|
|
|
|
|
Tyler Evensen wrote: Instead of thinking "Run", think I have the opportunity to build something from scratch using a better architecture and use cutting edge technology. That sounds like a lot of fun to me. Yeah, my thoughts exactly.
These are not easy jobs, but they can be quite fulfilling.
We plan to keep the UI more-or-less the same, but to give it a more modern look and feel.
No big overhauls there anyway.
Hopefully the client will say the same.
|
|
|
|
|
Having written and rewritten many programs in the last 35 years I can honestly say that without looking at the way you code I can't tell if the converters will work or not. Even current converters like Telrik have issues converting C# to VB.NET have issues.
The one thing that is 100% certain is this. If you review what you used to do and compare it to what you can now do you will probably get rid of a large portion of old code that is no longer needed.
If you worked in VB6 before .net and then you opened, closed, parsed files the old fashioned way either in binary or text. You can now ditch nearly all of that code lets face appending a line of text to a file used to take 10 lines of code now, 1 maybe 2? Splitting and parsing lines are now inherent, so is mid$ (now substring) and there are lots of new features to just the string object. vb6 had Drag and Drop nightmares .NET a breeze.
My point is the GUID may or may not change but the majority of code behind it probably won't take long to deal with side by side. If you run a conversion and it fails then you have to discover and repair code you didn't write and that sucks.
I rewrote a utility yesterday because it was built in 2001 and updated, but not rewritten in 2003. I opened the old code on one side the new on the other and reviewed it. The classes I had written had very few issues and with a few minor modifications those were done in less than a 1/2 hour. The rest of the time I spent dumping old code I no longer need and, I added a barcode class I had built about 5 years ago. In short I have a new tool that is 10 times faster, more capable and easier to use for the users.
I would say if you have a conversation system you can test it but then look at the code. If you don't understand it, rewrite it. If it fails, rewrite it....or just rewrite it. And don't believe those that say VB.NET is going away soon. They have said that for 15 years and it is more common than you know.
The old man in Illinois
|
|
|
|
|
Sander I have a copy of VB 6.0 Professional Edition + Library on CD IF needed which I doubt!
Also two great books "The Waite Groups VB 6 Interactive Course" and Murach's VB 6
You are welcome to all FREE.
Challenges and Work. Work pays the bills. Challenges can be fun but seem to create bills.
When you have time lets us know about the progress it will thoroughly enjoyed by many.
|
|
|
|
|
I'm doing that right now. I got hired to fix some VB6 stuff and then write a connected app in webforms .net.
After that they kept me on to do support and maintenance. As time allows, I re-write the VB6 to vb.net. Anything new is vb.net.
In a couple of instances I needed some of the VB6 functionality in vb.net to do some quick and dirty work. I copied the VB6 to a vb.net module and just went through line by line to make it compile in vb.net. It was surprisingly easy. I'd not recommend that for anything that is going to be maintained long term, but it might get you "over the hump" while port/re-write.
Someone else posted link her the tools and instructions to get VB6 to work on Windows 10. It actually works pretty well!
Also the are a couple of project underway to build IDEs and compilers for VB6. Twin BASIC looks pretty impressive. Here is a link to learn more: https://www.vbforums.com/showthread.php?890181-TwinBasic[^]
Good luck.
PS: Ask for a raise. They going have a tough time finding some who wants that job!
|
|
|
|
|
Had to do this a few years ago and ended up using VS 2005 to convert the code. It worked pretty well - even handled the many control arrays. The biggest problem was none of the custom controls we purchased would convert (or even install), so a lot of the GUI had to be rebuilt.
|
|
|
|
|
Did you know about TwinBasic? Maybe try this as an escape hatch from VB6.
TwinBasic is free but runs slower than normal until you buy a monthly subscription to get full version and your code will run about 3x faster than the free version of TwinBasic.
My broad recommendation is the following
- convert the DBase to a modern database like SQLite or SQLServer, hopefully with the VB6 intact and still running the same, so now you have the data layer more solid
- convert the front-end VB6 to TwinBasic.
With a bit of luck your code will compile with little to no modification.
- you might be able to stop here, with a modern TwinBasic application running your VB6 after conversion
- otherwise, my next step would be rewrite your VB6/TwinBasic forms as React frontend with .NET server code running the backend (maybe this code is installed on your local machine, maybe a remote server, maybe both).
- This is now mostly a rewrite of the frontend with React (initially inside embedded TwinBasic web browser control) As the new UI, and incrementally converting the backend to .NET until the app is able to run completely browser-based, then you can leave the TwinBasic code once you no longer need to support desktop installations.
Learn more about TwinBasic here:
twinBASIC GitHub
twinBASIC Updates
|
|
|
|
|
Pull out sketch first - letter learner to start with (10)
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|