Debugger Stepping into everything

G

Gino

Hi,

I have following code a close event for a form (WinForm VS2005)

If MsgBox("Are you sure you want to Exit Application ?",
MsgBoxStyle.YesNo + MsgBoxStyle.DefaultButton2, "Close Boris") =
MsgBoxResult.Yes Then
SaveOutstandingChanges()
Else
e.Cancel = True
End If

If I step through code and press Yes button on msgbox the debugger goes to
saveOutstandingChanges then highlights the E.Cancel line (Incorrectly). Has
anyone any ideas why this would/could happen?

I know I could place an exit sub after saveO.. and that would sort the issue
but I am seeing similar unexpected behaviour with debugger elsewhere and
trying to figure out what is causing it.
 
G

Gilbert Tordeur

Hi Gino.

I cannot answer your questions but I suggest you use the MessageBox class
and its Show method instead of your VB function.

Gilbert
 
A

Armin Zingler

Gino said:
Hi,

I have following code a close event for a form (WinForm VS2005)

If MsgBox("Are you sure you want to Exit Application ?",
MsgBoxStyle.YesNo + MsgBoxStyle.DefaultButton2, "Close Boris") =
MsgBoxResult.Yes Then
SaveOutstandingChanges()
Else
e.Cancel = True
End If

If I step through code and press Yes button on msgbox the debugger goes to
saveOutstandingChanges then highlights the E.Cancel line (Incorrectly). Has
anyone any ideas why this would/could happen?

I know I could place an exit sub after saveO.. and that would sort the issue
but I am seeing similar unexpected behaviour with debugger elsewhere and
trying to figure out what is causing it.

I can't repro the problem.
Try cleaning the solution (Build menu). Also set "On Run, when build or deployment errors occur" in
the options dialog box to "Do not launch" (under "Projects and Solutions" -> Build and run)
 
H

Herfried K. Wagner [MVP]

Gino said:
I have following code a close event for a form (WinForm VS2005)

If MsgBox("Are you sure you want to Exit Application ?",
MsgBoxStyle.YesNo + MsgBoxStyle.DefaultButton2, "Close Boris") =
MsgBoxResult.Yes Then
SaveOutstandingChanges()
Else
e.Cancel = True
End If

If I step through code and press Yes button on msgbox the debugger goes to
saveOutstandingChanges then highlights the E.Cancel line (Incorrectly). Has
anyone any ideas why this would/could happen?

If all else fails, delete the project's "bin" and "obj" directories and
make a clean build.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top