We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Formula Cells fail in multiple UI threads environment

We are using formula cells in our virtual grid and are having issues with the formula engine. We have a multiple GUI threads environment to maximize the performance on a multi-CPU machine. Each business component hosts a grid and gets created in a separate UI thread, with its own message pump using Application.Run(). The calculated formulas work only in the first grid. All subsequent grids start giving errors, such as "Invalid expression", even to the simplest formulas like "=123.45" (though "=123" seems to work fine). If you run all the grids in the same UI thread, there are no issues. Is this a known problem ? Any workaround possible ? We are using 3.3.0.0 version. I have attached a modified version of sample application FormulaValueTest_2003 that exhibits this problem. Thanks.

FormulaCellProblem.zip

2 Replies

AD Administrator Syncfusion Team July 18, 2006 10:28 PM UTC

Thanks for the sample. There are some ThreadStatic fields in the engine code that are not being initialized in the 2nd occurrences of the engine class. You can avoid this problem by making sure these static members are explicitly initialized in your code. Below show 2 added lines to the Form_Load code in your sample. private void Form1_Load(object sender, System.EventArgs e) { this.gridAwareTextBox1.BackColor = Color.FromArgb(237, 240, 246); this.gridAwareTextBox1.WireGrid(this.gridControl1); this.gridControl1.TableStyle.CellType = "FormulaCell"; this.gridControl1.RowCount = 1100; SetFormatFirstRow(); GridFormulaEngine engine = ((GridFormulaCellModel)this.gridControl1.CellModels["FormulaCell"]).Engine; //these 2 lines added GridFormulaEngine.ParseArgumentSeparator = '',''; GridFormulaEngine.ParseDecimalSeparator = ''.'';


UM Umesh Mahajan July 19, 2006 05:00 PM UTC

Clay,

Thanks for your quick answer. It works fine now.

- Umesh

Loader.
Live Chat Icon For mobile
Up arrow icon