Getting Line Number of Error

  • Thread starter Thread starter Luke Boyle
  • Start date Start date
L

Luke Boyle

I'd like to access the line number of the last executed line of code, so I
can have my Catch statement display it. In VB6, I used the Erl() function
to do this - is there anything comprable that can be used in .NET CF?

I'd even settle for forgoing the Try...Catch and just having the error show
the unhandled error message - if only the line number could be displayed
here. Is this even possible?

Thanks in advance,
Luke Boyle
 
Try

Catch (System.Exception ex){
MessageBox.Show(ex.ToSTring)
}
//Will give you line number on regular framework

I'd step through the code with the debugger to narrow it
down.

You can also wrap your code around where you think the
exception is happening and narrow it down from there.

Hope this helps.

Good Luck,

Bill
 
Unfortunately, ex.ToString (or ex.Message for that matter) in the CF won't
give you the line number of the error.

Thanks for the debugger advice, but I'm not trying to track down a current
error - I just want my Catch statement to show the line number for all
errors, in general (so the customer can give me the line number of the
error, and can then try to track it down).

Luke
 
Back
Top