3

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).

visual studio vb6 errors

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.

  • 3
    VB6 is very different to VB.net which Visual Studio uses so it's not surprising that you're seeing lots of errors. You need an installation of Visual Basic 6 to run and compile VB6 code. Mainstream support for it ended in 2005 so you'd have to find a secondhand copy. [This](https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-basic-6/visual-basic-6-support-policy) is the MS page on support for VB6. – John Eason Feb 01 '23 at 12:28
  • 1
    There were never any downloads of the IDE available. – John Eason Feb 01 '23 at 12:34
  • @JohnEason yes, there were, even in dev essentials, but it has been removed, other links I've found are dead. – daily_driver Feb 01 '23 at 13:22
  • Here's another [recent discussion](https://stackoverflow.com/q/74854972/5162073) on this issue. – Brian M Stafford Feb 01 '23 at 13:38
  • 1
    @BrianMStafford That appears to relate to a .Net 4 application not VB6 although it does mention Vb6 in the text. To my knowledge it's never been possible to compile and run native VB6 code in any version of Visual Studio. – John Eason Feb 01 '23 at 14:06
  • 2
    The VB6 IDE is available for download if you have a Visual Studio Subscription (Enterprise subscription, I don't know if it's available at the other subscription levels). "Visual Basic 6.0 Enterprise" is the product name. Otherwise, you'll need to convert the code, because as noted VB6 and VB.Net are different languages (highly similar, but different). VS2008 included an upgrade wizard that would take a VB6 project and convert it to VB.net, but frankly it sucked. – MarkL Feb 01 '23 at 15:37
  • VS2008 and maybe VS2005 could not run VB code but would make an attempt to convert it to VB.NET automatically. That conversion was useful but rarely could do a perfect job, though it could be a useful step in preserving existing code in some cases. – StayOnTarget Feb 02 '23 at 11:40
  • FWIW https://twinbasic.com/ aims to be fully backwards compatible with VB6. – StayOnTarget Feb 02 '23 at 11:41
  • @StayOnTarget: though as of now, it doesn't support any GUI: "We've started work on Forms and GUI elements" – Hel O'Ween Feb 03 '23 at 09:03
  • @HelO'Ween true, its a work in progress. I would say progress has been impressive and steady, but certainly more is needed. – StayOnTarget Feb 03 '23 at 12:57

1 Answers1

4

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.

Doc Brown
  • 19,739
  • 7
  • 52
  • 88