When you get an error message as shown below click on the View Detail.. link.
This will open this property box.
Expand the exception to show the details and hover the mouse over the StackTrace property.
Most of what you see listed there will probably be Greek to you (Apologies to the Grecian friends reading this), but if you look closer you will see lines that say
at "NAME OF A MODULE":Line 230 (or wherever)
The first line like that in the trace is the line that finally crashed the code. Simply go find that line in your code and try and figure out why that particular line is causing the specified error.
Subsequent lines of that format are the point in your code where the routine listed above was called from.
Now the images above are not a very good example since the IDE debugger stopped at the error line. But regardless, the stack-trace in invaluable when you properly trap errors in a try / catch statement. One of the properties of the exception is the stack-trace.. view it or dump it to the immediate window.
Try
Catch ex As Exception
Debug.Print(ex.StackTrace)
End Try
Also when running the exe version be familiar with the details pane. Its the same stack-trace.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…