Hi
The only way to capture the error number is if you save it inside the exception that was thrown.
public class MyException : Exception
{
// Rest of class
public int ErrorNumber;
}
Then you would do something like.....
catch( MyException ex )
{
// ex.Number would give you the error number
}
Hope this helps
Tincho
Main Topics
Browse All Topics





by: jj819430Posted on 2005-08-01 at 14:01:04ID: 14574039
What do you mean error code number?
All exceptions are derived from System.Exception
these have things in them like a message. You can create your own number schema for the errors (much like windows used to) but generally you want your errors to be descriptive.
you can do something like this.
System.Exception ErrorThrow;
public bool HasError = false;
public class myClass
{
public int myIntFunc()
{
int ReturnVal = -1;
try
{
...some operation
}
catch(MyExceptionType ER)
{
this.ErrorThrow = ER;
this.HasErrors = true;
}
return ReturnVal;
}
}