Automatic line numbering crazyness

  • Thread starter Thread starter Ben
  • Start date Start date
B

Ben

Hello all

After years of playing developing stuff for fun and personal use I'm
finally developing an app that I am intending to sell. As such, I'm
trying to make it as reliable and stable as possible and also ensuring
that it fails gracefully.

So, I'm trying to use the Erl property of the Err object so the users
get a line number as part of the error if things go wrong to make
troubleshooting easier.

However, it seems that you have to enter the line numbers manually in
your code which seems a little bizarre to me. In VB in VS2003 you can
turn on line numbers - I assumed that would enable line numbers in my
app but it doesn't. All it does it show you the line numbers but doesn't
actually embed them in the code leaving you having to enter your own. It
seems bizarre to me that the "turn on line numbers" or whatever option
is called turns them on for display only, leaving you to manually type
in your own.

Are there any workarounds for this? With all the work I'm going to be
going I really don't want to have to type in line numbers too if I can
possibly help it.

Cheers
Ben
 
I think that the Err object is a holdover from old VB and you should
definitely be using a structured exception handling scheme in your code.

Exceptions will report the specific line of code on which the error
occurred.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
Line numbers in VS.NET are only for visual purposes. They are not for error
reporting as it was in VB6 with the Erl function. In .NET you use
exceptions, which tell you the class and procedure name of the exception.
While using the Debug configuration (a .pdb file is generated), they tell
also the file and line number where the exception was thrown. So, you will
have to read the docs a bit about Structured Error Handling (try, catch,
finally, throw, etc.).

--

Carlos J. Quintero

MZ-Tools 4.0: Productivity add-ins for Visual Studio .NET
You can code, design and document much faster.
http://www.mztools.com
 

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

Back
Top