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.
Unfortunately, activation email could not send to your email. Please try again.

Formula Cells fail in multiple UI threads environment

Thread ID:

Created:

Updated:

Platform:

Replies:

46691 Jul 18,2006 04:16 PM Jul 19,2006 01:00 PM Windows Forms 2
loading
Tags: GridControl
Umesh Mahajan
Asked On July 18, 2006 04:16 PM

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

Administrator [Syncfusion]
Replied On July 18, 2006 06:28 PM

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 = ''.'';

Umesh Mahajan
Replied On July 19, 2006 01:00 PM

Clay,

Thanks for your quick answer. It works fine now.

- Umesh

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;