Wrox Programmer Forums
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 31st, 2008, 12:01 AM
Friend of Wrox
 
Join Date: Mar 2008
Posts: 133
Thanks: 15
Thanked 1 Time in 1 Post
Send a message via ICQ to iceman90289 Send a message via AIM to iceman90289
Default debug code

was it in C# that you could have code in your program to give you the line and collumn that an error occured? i have an error handler but i do not know where the error is coming from.

 
Old March 31st, 2008, 02:05 AM
Friend of Wrox
 
Join Date: Dec 2006
Posts: 176
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by iceman90289
 was it in C# that you could have code in your program to give you the line and collumn that an error occured? i have an error handler but i do not know where the error is coming from.

if your error is a compile error, just double click on the error in Error List window.
and if your error is runtime, you can write a try/catch block and with the exception argumant you can get the details of error
for example

try
{
    // your code goes here
}

catch(exception ex)
{

   // with ex.StackTrace you can get the error details if
   // any error occure in your try block
   // note, ex.Message just will give you a string message about
   // exception such as "input string was not in a correct format"
   // if a format exception was thrown

}
 
Old March 31st, 2008, 03:39 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

If you are running a debug copy of the file, and have the .pdb file with the application then the Exception.ToString() method should give you filenames and line numbers for where errors occurred.

/- Sam Judson : Wrox Technical Editor -/





Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't Debug Jul-2008 code under VS2008 agemagician BOOK: Professional Microsoft Robotics Studio ISBN: 978-0-470-14107-6 1 November 7th, 2008 02:11 AM
Help Debug arholly Access VBA 19 December 18th, 2006 01:52 PM
first debug problem in my code haagen Java Basics 2 September 25th, 2006 03:28 AM
Can't debug sithlrd General .NET 9 July 28th, 2004 05:00 PM
Can't Debug shmacgregor General .NET 6 March 1st, 2004 05:10 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.