Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 31st, 2008, 12:01 AM
Friend of Wrox
 
Join Date: Mar 2008
Location: So Cal is good enough for you, California, USA.
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.

  #2 (permalink)  
Old March 31st, 2008, 02:05 AM
Friend of Wrox
 
Join Date: Dec 2006
Location: , , .
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

}
  #3 (permalink)  
Old March 31st, 2008, 03:39 AM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
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 -/
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 05:45 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.