Debug my app... an error on my form

Debug my app... an error on my form

mdhutchinson
Advisor Advisor
325 Views
6 Replies
Message 1 of 7

Debug my app... an error on my form

mdhutchinson
Advisor
Advisor
I have a call to myuserform.show in my main module.
If an error occurs in setting up the form, if I hit the Debug button the debugger takes me to the myuserform.show line that is in my main module...
Why doesn't it take me to the actual line of code that sparked the error? Is there some setting I should make that will cause it to highlight the line of code that caused the error?
0 Likes
326 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
what makes you think that the line of code causing the error isnt the line
it took you to?

can you show several lines before and after that particular line?

wrote in message news:5750774@discussion.autodesk.com...
I have a call to myuserform.show in my main module.
If an error occurs in setting up the form, if I hit the Debug button the
debugger takes me to the myuserform.show line that is in my main module...
Why doesn't it take me to the actual line of code that sparked the error?
Is there some setting I should make that will cause it to highlight the line
of code that caused the error?
0 Likes
Message 3 of 7

Anonymous
Not applicable
VABIDE-menu Tools->Options...->Tab "General"->radio button "BreaK on all
errors"


wrote in message news:5750774@discussion.autodesk.com...
I have a call to myuserform.show in my main module.
If an error occurs in setting up the form, if I hit the Debug button the
debugger takes me to the myuserform.show line that is in my main module...
Why doesn't it take me to the actual line of code that sparked the error?
Is there some setting I should make that will cause it to highlight the line
of code that caused the error?
0 Likes
Message 4 of 7

Anonymous
Not applicable
I have experienced the same thing.

I dare say if he commented out all the code in the form. He would not receive the error at the line that is trying to show the form.

Regards - Nathan
0 Likes
Message 5 of 7

mdhutchinson
Advisor
Advisor
I have a form with a specific name...
The line of code the debugger took me to is:

frmContManager.Show

That is the name of my form module.
Now... Break on all errors does just that... the debugger breaks on every err whether I have an error handler or not.
For instance I have several places where I add items to collections with a specified key. If the key is already in the collection it pops an error... however I have specific error handle in place to assure the code continues. If I set 'Break on all errors' it break on all errors, even these that have error handlers in place.
Now if I set the debugger to stop on un-handled errors, which I thought would be the next best setting... but if the error happens in my form module the debugger doesn't take me to the error. Instead it highlights the
frmContManager.Show line of code that happens to be in my main module.

Any way thanks all for your thoughts.
0 Likes
Message 6 of 7

Anonymous
Not applicable
"Break on all error" should only used for debugging, unless your code does
not apply any error handling (bad, bda thing!).

In your case, set to "Break on all error" is only to help you see what cause
the error. You have obviously unhandle error in the user form module. Most
likely, you used "On Error Resume Next", but did not handle all possible
runtime error for EACH line of code.

So, use "Break on all error" to thoroughly testing your code for all
possible exceptions, and make sure you handle it. If your "On Error resume
Next" and testing error after certain line of code could miss possible
exception, you need to use "On Error Go To" to catch all exception, handle
it, then decide you want to "Resume" or "Exit". Do not use "Break on all
error" in production run, unless you are sure there is no exception to
catch.


wrote in message news:5751924@discussion.autodesk.com...
I have a form with a specific name...
The line of code the debugger took me to is:

frmContManager.Show

That is the name of my form module.
Now... Break on all errors does just that... the debugger breaks on every
err whether I have an error handler or not.
For instance I have several places where I add items to collections with a
specified key. If the key is already in the collection it pops an error...
however I have specific error handle in place to assure the code continues.
If I set 'Break on all errors' it break on all errors, even these that have
error handlers in place.
Now if I set the debugger to stop on un-handled errors, which I thought
would be the next best setting... but if the error happens in my form module
the debugger doesn't take me to the error. Instead it highlights the
frmContManager.Show line of code that happens to be in my main module.

Any way thanks all for your thoughts.
0 Likes
Message 7 of 7

mdhutchinson
Advisor
Advisor
These appear to be good thoughts.
Thanks
0 Likes