简体   繁体   中英

Creating a Visual Basic 6 project from existing code in Visual Studio 2022 results in millions of compilation errors

Trying to do this on Windows 10.

I have a VB6 folder and I'm trying to make a solution out of it.

Visual Studio succeeds in making a project, but when trying to compile it gives millions of errors (see image).

视觉工作室 vb6 错误

I've read conflicting info about VB6 support in Visual Studio. On one hand it's written that Visual Basic is supported, but not VB6? There also used to be a VB6 IDE, but I can not find a download for it.

Should I use Visual Studio 2008 or something?

What are my options?

Thank you.

When Microsoft today uses the abbreviation "VB", they usually mean "VB.NET", the successor of classic VB published by Microsoft in 2002 . According to this source , the latest version of VB, called VB6, appeared in 1998, and 10 years later Microsoft dropped any support for VB6 and its IDE.

Unfortunately, VB.Net is not backwards compatible to VB6, it is a different programming language (though it has some properties which arguably make it easier to port VB6 to VB.Net than to other.Net languages like C#). You cannot compile VB6 programs directly with Visual Studio 2002 or later, you usually need the original VB6 IDE. That leaves you basically with two options:

  • Try to find a copy of the old VB6 IDE and compile the program with it (if you cannot get it from where you got the source code, according to the comments, you may have luck at Microsoft, when you have the right developer subscription level).

  • Port the VB6 application to VB.Net. For this, however, you should have some not-too-basic knowledge of both languages, know the differences and ideally have an environment where you can test the original application against the ported one. I did this by myself in the past for some applications, so I know it can be less effort than recreating an application completely from scratch. However, this depends a lot on the specific application, how large and complex it is, how large the UI parts are and which kind of 3rd party components were involved. To be honest, if the application is not trivial, you should have a VB6 IDE for this approach, too.

Note also when your old VB6 code uses 32-bit third party OCX/ActiveX components, for porting it to VB.Net I would recommend to use VS2019 or an earlier version, not VS2022. The current Winforms Designer of VS2022 is not compatible with 32 bit OCX components any more , and it is unclear if MS will ever publish a version which will be.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM