No prob. BTDT. :-)
Bill
>Bill,
>
>You are right. Thank you.
>
>Jerry
>
>
>>Hi Jerry,
>>
>>I believe you're catching a different exception than you're Throwing. I.e. you're Throwing an ApplicationException, but you're Catching an ArgumentException.
>>
>>Bill
>>
>>>I am using VS .Net 2005 and I am trying to throw an ApplicationException() inside of my method and trap that error with a TRY/CATCH block. However, I can't get this to work. Below is my code.
>>>
>>>
>>>public void function1()
>>>{
>>> try
>>> {
>>> //This should trap error.
>>> this.function2();
>>> }
>>> catch (ArgumentException ae)
>>> {
>>> MessageBox.Show("An error occurred! -> " + ae.Message);
>>> }
>>>}
>>>
>>>public bool function2()
>>>{
>>> string lc_value = "";
>>> if (lc_value == "")
>>> {
>>> throw new ApplicationException("My Error occurred!");
>>> }
>>>
>>> //Continue normal operation.
>>>
>>> return true;
>>>}
>>>
>>>
>>>I would expect that when the throw new ApplicationException() was triggered, that my CATCH block would gain control and display my custom error message. However, what actually happens is that a VS error dialog displays my custom message and my CATCH block is not called.
>>>
>>>How can I trigger a error and capture it with a TRY/CATCH block?
>>>
>>>Thanks,
>>>
>>>Jerry
William A. Caton III
Software Engineer
MAXIMUS
Atlanta, Ga.