Hi
I have a question about how to check the formula string is in the corrected format that the method "calculate" can calculate it.
for example, if i put the formula string like
answer = uc1.Calculate("+").ToDecimal() '''''''''condition 1
instead of
answer = uc1.Calculate("2+3").ToDecimal(). '''''''''condition 2
how can i set answer = 0 on event like condition1
Hi - i'm looking for a similar answer to the question but in a slightly different way. Is there any way of checking for an error without using try catch blocks? I'm basically doing something similar but it's done quick a few times all at once. Try - Catch is really slowing my app down.
Many thanks.
Hi,
I'm not sure if you have already figured this out, but since there is no response from anyone (in almost a year), and your question actually helped me solve an issue I was having, I thought I would try an answer your question, if not to help you, to maybe help someone else who has this issue in the future.
I solved this by wrapping your code in a try{}..catch{} function, like this:
try
{
answer = uc1.Calculate("+").ToDecimal();
}
catch (Exception ex)
answer = 0;
I hope this help you or anyone else who comes across this issue in the future.
Mark