This is a bit of an odd request / question.
In our implementation of the UltraGrid, we allow columns to be inserted by the user with a formula attached to them.
To set the formula we show the Formula Builder Dialog.
It's been noticed that if a user enters a formula with a syntax error, despite being warned that formula is invalid, if the user chooses to continue anyway a "scary to the end user" Infragistics error dialog appears (twice actually, duplicates) of the format:
"A syntax error occured while compiling a formula for: //DisplayGrid/results0/Column1
The error is:
Unexpected end of file, on line: 1 column 10"
This error dialog occurs after the following line of code:
formulaProvider.Formula = formulaBuilderDialog.Formula
Obviously the user was warned up front that the formula contained a syntax error. They also are acknowledging they understand this by choosing to continue. However, I've been asked if there is anything that can be done to not show the error dialog.
I understand I could check the .HasSyntaxError property after the dialog returns and if it's true, simply not assign the formula. But by doing so, it'd be incredibly confusing to the user to initially allow them to use an invalid formula, then immediately follow that by throwing it away.
What I'm looking for, in order of priority is:
1) Not show the infragistics compilation error at all
2) If that's not possible, at least only show the compilation dialog once.
Any help would be appreciated. If the answer is "nothing can be done if you're going to use the provided FormulaBuilderDialog", at least I can present that to product management.
Thanks,
Chris Rowland
Hello Christopher,
I am just checking did you solve your issue accordingly to the information that Michael Saltzman provided you?
Let me know if you need any further assistance.
Hi Chris,
I don't see any reason why you should be getting the error twice. That might be a result of something you are doing in your code - perhaps adding the formula to two columns, or compiling it once and then applying it to the column where it get compiled again. Or that might just be a bug.
If you can send me a sample demonstrating the dialog coming up twice, we would be happy to look into it.
But either way, turning off the dialog is very easy:
private void ultraCalcManager1_FormulaSyntaxError(object sender, Infragistics.Win.UltraWinCalcManager.FormulaSyntaxErrorEventArgs e) { e.DisplayErrorMessage = false; }