By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,327 Members | 1,195 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,327 IT Pros & Developers. It's quick & easy.

Cross IDE Debugging - VB.Net to VB6

P: n/a
I'm sure you'll look at this question and wonder if I've been sniffing
glue. I haven't, really.

My legacy app is written in VB6 and we're chipping away at converting it
to .Net. I badly need to be able to step from VB6 IDE into a running
VB.Net session to debug the .Net component. This is trivial if I'm
running a compiled VB6 app, but that doesn't get me what I need.

Can I cross the IDE boundary like this?

Sean
Nov 21 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a

"Sean Kirkpatrick" <na**********@community.nospam> wrote in message
news:%2***************@TK2MSFTNGP14.phx.gbl...
I'm sure you'll look at this question and wonder if I've been sniffing
glue. I haven't, really.

My legacy app is written in VB6 and we're chipping away at converting it
to .Net. I badly need to be able to step from VB6 IDE into a running
VB.Net session to debug the .Net component. This is trivial if I'm running
a compiled VB6 app, but that doesn't get me what I need.

Can I cross the IDE boundary like this?


Yes. In VB.NET just attach to the VB6 IDE's process.

David
Nov 21 '05 #2

P: n/a
Sean Kirkpatrick wrote:
I'm sure you'll look at this question and wonder if I've been sniffing
glue. I haven't, really.

My legacy app is written in VB6 and we're chipping away at converting it
to .Net. I badly need to be able to step from VB6 IDE into a running
VB.Net session to debug the .Net component. This is trivial if I'm
running a compiled VB6 app, but that doesn't get me what I need.

Can I cross the IDE boundary like this?

Sean


Never tried it that way, but if you launch your VB6 app and then go to
Visual Studio and choose Tools -> Debug Process. Attach to the VB6
process and you should be able to put a break point in your .net app.

Chris
Nov 21 '05 #3

P: n/a
Sean,

"Sean Kirkpatrick" <na**********@community.nospam> schrieb:
My legacy app is written in VB6 and we're chipping away at converting it
to .Net. I badly need to be able to step from VB6 IDE into a running
VB.Net session to debug the .Net component. This is trivial if I'm running
a compiled VB6 app, but that doesn't get me what I need.

Can I cross the IDE boundary like this?


Yes, that's actually possible. Just create your VB6 project and your VB.NET
projects (a class library, for example) and reference the VB.NET project
from your VB6 project. Create a debug build of your VB.NET project.

To debug the projects together, open both projects, the VB.NET class library
project in VS.NET and the VB6 project in the VB6 IDE. Set breakpoints in
the class library project. Then start the VB6 EXE project from within the
VB6 IDE. Switch to VS.NET and choose "Debug" -> "Processes..." and select
"VB6.EXE". If the VB6 application is not started from within the IDE,
choose its EXE file from the list. Now you can debug the VB.NET class
library within VS.NET. If execution reaches a breakpoint, for example, it
will be highlighted in VS.NET and execution will be stopped until you
continue execution.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #4

P: n/a
Thanks all - I see how it's done. Unfortunately, both IDEs crash when I
try to step into the .Net project. I submitted a crash report and MS
says that the problem is most likely caused by the .Net Framework 1.1. I
installed the lastest .Net service pack but nothing changed. :(

Sean
Herfried K. Wagner [MVP] wrote:
Sean,

"Sean Kirkpatrick" <na**********@community.nospam> schrieb:
My legacy app is written in VB6 and we're chipping away at converting
it to .Net. I badly need to be able to step from VB6 IDE into a
running VB.Net session to debug the .Net component. This is trivial if
I'm running a compiled VB6 app, but that doesn't get me what I need.

Can I cross the IDE boundary like this?

Yes, that's actually possible. Just create your VB6 project and your
VB.NET projects (a class library, for example) and reference the VB.NET
project from your VB6 project. Create a debug build of your VB.NET
project.

To debug the projects together, open both projects, the VB.NET class
library project in VS.NET and the VB6 project in the VB6 IDE. Set
breakpoints in the class library project. Then start the VB6 EXE
project from within the VB6 IDE. Switch to VS.NET and choose "Debug" ->
"Processes..." and select "VB6.EXE". If the VB6 application is not
started from within the IDE, choose its EXE file from the list. Now you
can debug the VB.NET class library within VS.NET. If execution reaches
a breakpoint, for example, it will be highlighted in VS.NET and
execution will be stopped until you continue execution.

Nov 21 '05 #5

P: n/a
Hi

I assume you are call .NET exposed COM object from vb6.
I think you may try to follow the steps below debuging vb6 app in vs.net.
1. Compiled the VB6 with Create Symbols
2. Set the Startup program when debugging for the VB.NET dll with the VB6
project1.EXE and check the unmanaged debugging option in the project
setting.
3. Open the Form1.frm in the vb.net IDE
4. Set break point in the Form1.frm's code line
5. F5 to run the VB.NET DLL project, because we have set the VB6
project1.EXE as the start up program, it will be run to hit the break point
in the Form1.frm
e.g.
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3090
ScaleWidth = 4680
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 495
Left = 1800
TabIndex = 0
Top = 1320
Width = 1215
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim o As New TestCrossDebugVB6.MyTestClass
Dim s As String
s = o.TestString() 'If we set break point here, it will be hit when we
click Command1
MsgBox s
End Sub

[VB,NET]
Imports System.Runtime.InteropServices
<ClassInterface(ClassInterfaceType.AutoDual)> _
Public Class MyTestClass
Public Function TestString() As String
Return "Hello World"
End Function
End Class
You may have a try.
Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.