4
Reply

C# Exception error question

Jacob R

Jacob R

Jun 16 2010 10:45 PM
2.3k

I'm a bit confused about this.  Would a method with a try catch block, catch the error of another method that it calls?  I'll do some example code...
 

 private void methodA()
{
   try
   {
      ...do some code
      methodB();
   }
   catch (exception e)
   {
      messagebox.show(e.message);
   }
}
 
private void methodB()
{
   do some code that errors...
}

 
So will methodA display the exception.message that methodB encountered?  If not, can you explain how I would get it to?
 
Thanks
-Shifty

Answers (4)