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

Formula is not working

Thread ID:





14370 May 25,2004 09:10 PM UTC May 25,2004 09:44 PM UTC WinForms 2
Tags: GridControl
Asked On May 25, 2004 09:10 PM UTC

Clay as per your advice I started working and it looks like I am on right track I need help with following issue: I have two grid controls on my form. On the top I have a GridDataBoundGrid control and at the bottom I have GridControl. I am using following code to set the formula in bottom grid and this is where I need help. // formula int sheetfamilyID = GridFormulaEngine.CreateSheetFamilyID(); GridFormulaEngine.RegisterGridAsSheet("top", this.gridDataBoundGrid1.Model, sheetfamilyID); GridFormulaEngine.RegisterGridAsSheet("bottom", this.gridControl1.Model, sheetfamilyID); GridFormulaEngine engine = (GridFormulaCellModel)this.gridControl1.CellModels ["FormulaCell"]).Engine; engine.UsesVirtualDataSource = true; //allow formulas in any cell this.gridControl1.TableStyle.CellType = "FormulaCell"; //add sum formulas //grid 1 top grid this.gridControl1[5,1].Text = "=SUM(top!B4:top!B5)"; I have following values at top grid gridDataBoundGrid1[B4] = 10 gridDataBoundGrid1[B5] = 20 When I first run the application ‘0’ shows up as value of Formulacell at gridControl1[5,1] while it should be ‘30’. If I go in formula cell in bottom grid while application is running and edit formula to something and change it back to original then as soon as I am out of the cell correct value shows up as ‘30’. From this point on if I do any change in top grid it reflects properly in formula cell in bottom grid. Why is it not working very first time when I start the application? What is wrong with my code? Please help. Thanks

Administrator [Syncfusion]
Replied On May 25, 2004 09:41 PM UTC

Do you have this code in FormLoad? If not, try moving it there. Also, try reversing the order in which you call RegisterGridAsSheet, calling this first on the bottom sheet. (The reason is that the bottom grid is really the only one with formulas in it, and it should probably be the first one registered. After switching the order, try calling engine.RecalculateRange(GridRangeInfo.Table(), true) at the bottom of FormLoad. This should force the gridControl to recalculate, and hopefully show the proper values initially. Make sure you have already loaded the data in the GridDataBoundGrid.DataSource before you call engine.Recalculaterange, otherwise teh GridControl will just use zeros for these missing values.

Replied On May 25, 2004 09:44 PM UTC

reversing the order Worked. Thansk clay.


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon

Live Chat Icon For mobile
Live Chat Icon