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.

GridControl FormulaCell update

Thread ID:





9832 Jan 13,2004 11:45 AM Jan 15,2004 12:06 PM Windows Forms 6
Tags: GridControl
Paul Laudeman
Asked On January 13, 2004 11:45 AM

Hello, I''m curious to know how I can catch an event or otherwise be notified when a formula cell type is or has been updated. Specifically, I''d like to be able to capture the new value that is computed as soon as it changes so I can persist the result of the formula. Thanks! -Paul

Administrator [Syncfusion]
Replied On January 13, 2004 12:02 PM

SaveCelInfo is one place you can try to do this. But it is fired for all cells, so you would have to check e.Style.CellType or e.Style.FormulaTag to see if the cell is a formula cell. Another problem is that the engine normally only computes the values when they are needed. So, if you make a change that affects 1000 cells that are not displayed currently, those 1000 cells are not recomputed until thay are needed. So, the idea of persisting all computed values needs to be thought through as the default behavior may not recompute all cells. If you want to force all cells to be computed, and you are storing the values in the grid itself (not using it virtually), then you can call engine.RecalculateRange passing in the whole grid and setting the second parameter to true.

Paul Laudeman
Replied On January 15, 2004 05:47 AM

Clay, I was experimenting with the RecalculateRange method, but when I try to run it I get the following exception: Object reference not set to an instance of an object. System.NullReferenceException: Object reference not set to an instance of an object. at Syncfusion.Styles.StyleInfoBase.GetValue(StyleInfoProperty sip) at Syncfusion.Windows.Forms.Grid.GridStyleInfo.get_CellType() at Syncfusion.Windows.Forms.Grid.GridStyleInfo.get_CellModel() at Syncfusion.Windows.Forms.Grid.GridFormulaEngine.RecalculateRange(GridRangeInfo range, Boolean forceCalculations) at Syncfusion.Windows.Forms.Grid.GridFormulaCellModel.RecalculateRange(GridRangeInfo range, Boolean forceCalculations) Do you know what might be causing this exception?

Paul Laudeman
Replied On January 15, 2004 05:54 AM

From digging through the grid source, it looks like the GridFormulaCell class is throwing an exception in the RecalculateRange method (line 930) because for whatever reason the GridStyleInfo of the cell is null and when the code attempts to access the CellModel it can''t. Thanks, -Paul

Paul Laudeman
Replied On January 15, 2004 06:05 AM

Oops, I meant to say that the CellModel property is null, not the GridStyleInfo object. Is there a fix or work around available for this issue? Thanks again.

Administrator [Syncfusion]
Replied On January 15, 2004 08:27 AM

What version are you using? I think this is fixed in our and beta releases.

Paul Laudeman
Replied On January 15, 2004 12:06 PM I did find a work around for it. Thanks anyway!


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.