views:

74

answers:

4

Is one able to compile VB 6 code in Visual Studio.NET ? In other words, is it backwards compatible with older VB code?

Since I know there is a difference between managed code (.NET) and unmanaged code, I am wondering if Visual Studio.NET is able to compile unmanaged code as well?

Kind regards, Kris

+2  A: 

Hi there.

No, you can;t compile VB6 code in any VS.NET version.

cheers. Jas.

Jason Evans
So basically all new Visual Studio versions since .NET don't support VB6 code anymore right? There does not exist such things as Visual Studio 2003.
Kris Van den Bergh
I'm afraid not. There is no version of Visual Studio that will compile VB6 code. Your best bet, as tanging suggests, is to use `COM Interop` to access your VB 6 code, if that is what you wish.
Jason Evans
+1  A: 

No it is not compatible. I think there is an upgrade wizard, but you will end up fixing some stuff manually.

Stefan Egli
+4  A: 

While you cannot compile vb6 in the .net Visual Studios, you may use interop libraries to allow vb.6 to utilize managed code http://msdn.microsoft.com/en-us/library/kew41ycz%28VS.71%29.aspx

tanging
+1 Good advice. Microsoft UK have some more good advice for people with "legacy" VB6 code [here](http://msdn.microsoft.com/en-gb/dd408373.aspx) - it covers interop and other issues.
MarkJ
+2  A: 

You can open a VB6 .vbp project file in Visual Studio. This automatically invokes the project converter, it will try to translate your VB6 code into VB.NET. The translator does a fairly decent job of it but the VB.NET language has changed pretty drastically. It depends on how 'clean' your VB6 code was.

After the conversion is completed, you'll have to walk through the list of warnings and errors you'll get. Getting none at all is rare. There might be hundreds or thousands. If you're in that boat, it starts making sense to rewrite the code.

Anyhoo, just try and see what hits the fan. You'll have a good idea what you're in for in about ten minutes. Don't forget to copy the project before you start the conversion.

Hans Passant
I would add, there's lots more advice about VB6 migration in the questions tagged [vb6-migration](http://stackoverflow.com/questions/tagged/vb6-migration)
MarkJ