In project based companies new technologies are easily adopted but this is not the case with Product based companies. Once the product is developed they have to stick with the language for years with which they developed it. Converting a product into a different programming language involves lots of development costs and this is not feasible every time.
Microsoft has done a good job by introducing Interop Toolkit. We can now develop new modules in .NET and use them in VB6. In this way we can use many good features provided by .NET. Here we use two languages .NET and VB6. So the debugging becomes little tricky, but it's not a big deal.
Debugging VB.NET code from VB6 is no different than debugging any other Visual Basic 6.0 project. Press F5 to run, attach VB6 process in VB.NET IDE, set breakpoints, and debug as you normally would.
Follow these steps to debug your .NET code:
- Load your .NET project in Visual Studio 2005.
- Build the .NET project if it has not already been built.
- Load your Visual Basic 6.0 code in the Visual Basic 6.0 IDE.
- Run your application by pressing F5 in the Visual Basic 6.0 IDE (Note: You must do this once before attaching the .NET debugger to properly load the .NET code).
- In Visual Studio .NET 2005, select Attach to Process... from the Tools menu.
- In the dialog that appears, select the VB6.exe process (Note: because the Visual Basic 6.0 code runs within the Visual Basic 6.0 IDE, you must select this process to debug).
There is also an another way for debugging. Instead off attaching the vb6.exe process everytime you can configure settings in Project properties to run external program while debugging.
Follow these steps:
- Go to the Project properties window and select Debug tb.
- In Start Action section select Start external program and type the path of vb6.exe. e.g. C:\Program Files\Microsoft Visual Studio\VB98\VB6.EXE.
- In Command line arguments type the vb6 project path. e.g. "D:\Test Projects\Project1.VBP".
- Save the settings, set the break proints and press F5.
This will open the VB6 project. Press F5 to run and start debugging.