Is there a reason why VB6 cannot be ported to .Net?

I'm not talking about porting a VB6 application to .Net (which has been talked about a lot here).

I just thought: if you can do IronPython, IronRuby, Phalanger, H #, etc., is there any technical reason that would prevent you from building VB6.Net?

I think there will be a lot of money in it .

UPDATE Sorry for all the purists, I KNOW VB.Net is "better", but when you have hundreds of thousands of lines of code, that's just not a good enough argument. Here is Joel's post which was part of the inspiration for this question.

+2


source to share


6 answers


1/2 Yes and 1/2 No. A full 100% workalike would be a pretty tough conversion since VB6 guesses are built on COM. COM assumptions are not the same as .NET. Where you really run into a problem is the VB6 IDE emulation.

It is much easier to write a compiler that is compatible with Vb6 text. An unusual trick to remember is that you can write assemblies that can adapt certain VB6 features to .NET. For example printer object, vb6 graphic object. File access, etc. Etc. There is also a formatted form issue and you will need a converter for the FRX file. You will still have behavior problems, but in theory you can minimize this in the VB6 support libraries.

Nothing stopped Microsoft from doing this. It was the arrogance of the original .NET team that led them to "fix" VB6. Yes, as a language VB.NET has many interesting features over VB6. But back then VB6 had a lot of cool features over QuickBASIC. But with VB6 I can take the QuickBASIC code and dump it into VB6 and have a reasonable chance of getting it working. Especially for modules that have nothing but business logic. It is not the same with VB6 on VB.NET. Most of the problems are caused by changing the integer from 16 to 32 bits.

The loss of even minimal backward compatibility was and remains a problem. Since Ruby, Python and other languages ​​have been ported to .NET, the arbitrary nature of choice that the original VB.NET team opened up.

The best solution at the moment is probably the minimal approach. Now that we have had several years of experience with VB.NET, the most problematic areas are well known.

Some from the head>



1) Enter the OPTION INT BASE statement. By default, integers will be 32-bit and longs will be 64-bit. However, if you use OPTION INT BASE 16. Then Integer will compile to Int16 and Longs will compile to Int32. This will also require some changes to Intellisense. So when he asks for meta, the tooltip tells you the correct base type. Understand that all Int16s and Int32s are in the metadata.

2) Have reliable builders of graphic printer, screen and vb6 helpers. Microsoft has 3/4 implementation of the printer object. The Vb6 Graphis object is buried there and can be retrieved using the .NET reflector and used separately. But there are many suitable and completed works to be done.

3) Use the option using the original VB6 keywords using these satellite assemblies. The compiler will translate these into satellite assembly calls.

There are other problems in database access and in other areas. Much of this can be solved by extending the options and keywords that VB.NET has.

Of course, there is now a big divide in the Microsoft Basic community. Expect a lot of static and complaints if these parameters are added. Perhaps if I were a VB.NET manager, I would fork out the VB.NET compiler into the VB6.NET compiler to keep this to a minimum. This will depend on whether this option affects the current version of VB.NET.

You can read more about the issues here .

+4


source


Technically, I think it will be difficult. And I don't think there will be a demand for it.

People invest money and time in tools to port VB6 code to .Net, but not to create "VB6.Net". Clients need to get their VB6 code assets on the programming platform... Personally, I would need a lot of convincing that the VB6 port would be reliable and supported.



Instead, migration providers are working on things like runtime libraries. For example VBMigration.COM announced this month , they add a wrapper for ADO.Net. It's a collection of native .NET classes that behave exactly like their ADODB counterparts, but use ADO.Net behind the scenes. If you can make .NET emulate the VB6 runtime behavior like this, there is no need to port the VB6 language itself.

EDIT: I just came across another idea : create a VB6 clone that supports multiple platforms like RealBasic : Windows, Mac, Linux ... There might be some demand for this. You still need to convince people that you continue to support the language, though.

+4


source


Why bother when there are VB.NET tools to help you migrate from VB6 ? This fact negates your monetary argument. Of course, this is technically possible, but it would be a big task. Barriers are not technical, they are financial and motivational.

+2


source


I listened to the DotNetRocks podcast with Paul Wick a couple of years ago . This is the guy that was on the VB6 team. Ears, he was asked a similar question. His answer was that it was just too difficult, because over the years of development for VB6 (and earlier vb5, 4, 3, 2, 1), the codebase has acquired a huge number of cracks that would be extremely difficult to port to a completely new platform.

+2


source


Visual Basic 4, 5, and 6 were COM based. COM defines a binary interface between components (ABI) and the object model (including memory management).

.NET also defines these things, but in a fundamentally different way (like GC, not reference counting).

Since VB6 relies on the COM way of doing things, there would be a major drag mismatch with "pure .NET" as you see in C ++ / CLI, where you need to handle .NET and native objects and types a little differently.

Remember, you can use VB6 components from .NET and vice versa using COM interop, so a gradual change is possible.

0


source


I guess this is absolutely portable. If you think money will be made in it (and you may well be right), get to work .; -)

Leaning back from my head, I see no reason preventing this, and I have worked with VB6 and .NET for a long time. On the other hand, I don't see many advantages in it. Integrating VB6 with the rest of the framework can be quite tricky; VB6 just lacks a lot of features that make it harder than necessary. Thus, there is no tangible benefit to porting VB6 applications to .NET (by porting VB6 to .NET). In addition, new .NET code can interoperate with existing VB6 code and vice versa.

The only benefit is to get a modern IDE, but that's a different matter entirely in porting the language.

0


source







All Articles