error handling question

G

George Hardy

in vs2003, this used to work:

try
<code>
catch ex as exception
msgbox "Error: " & ex.message
end try

in vs2005, this does not seem to throw a message box up, even tho it does
make it in the catch...when i try to examine the "ex" variable, it says it
is not declared in the current scope. why is this? It kind of makes it
hard to debug if i cant examine the exception object.

any suggestions?

thanks!
g hardy
 
A

Armin Zingler

George Hardy said:
in vs2003, this used to work:

try
<code>
catch ex as exception
msgbox "Error: " & ex.message
end try

in vs2005, this does not seem to throw a message box up, even tho it
does make it in the catch...when i try to examine the "ex" variable,
it says it is not declared in the current scope. why is this? It
kind of makes it hard to debug if i cant examine the exception
object.

any suggestions?

What else happens instead of the message box? Does the code continue after
the End Try? If not, what's the callstack if you press Ctrl+Break?
In general, it should work; as it does here.


Armin
 
H

Herfried K. Wagner [MVP]

George Hardy said:
in vs2003, this used to work:

try
<code>
catch ex as exception
msgbox "Error: " & ex.message
end try

in vs2005, this does not seem to throw a message box up, even tho it does
make it in the catch...when i try to examine the "ex" variable, it says it
is not declared in the current scope. why is this? It kind of makes it
hard to debug if i cant examine the exception object.

It should work too in VB 2005. On my machine it just works fine, the
message is shown and I can examine the 'ex' variable in the debugger when
placing a breakpoint on the 'MsgBox' call.
 

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