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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How do I change a formula in a formulaCell type?

Thread ID:

Created:

Updated:

Platform:

Replies:

71548 Feb 5,2008 03:44 PM UTC Feb 8,2008 02:36 AM UTC WinForms 5
loading
Tags: GridControl
Paul P
Asked On February 5, 2008 03:44 PM UTC

I have a rather complex formula, that I would to be able to change "by hand" when certain conditions occur.

How can I change a formula in a GridControl? If I just reset the .Text, nothing happens

thanks.

-Paul


SubhaSheela R [Syncfusion]
Replied On February 6, 2008 07:32 AM UTC

Hi Paul,

Thank you for using Syncfusion products.

You can change the formula programmatically by setting new formula to the Text property of the GridControl . I have created a sample that shows the formula in a cell programmatically. Could you please give me more details about the complex formula, so that I could provide you the exact solution? Or please send us a sample with the issue, we will analyze it and provide you the details.
Below is the code snippet:

this.gridControl2[2, 3]. Text = "=(A2+B2)";


Please refer the sample available in the link below and let me know if it helps:

http://websamples.syncfusion.com//samples/ Grid.Windows/F71548/main.htm

Regards,
Subhasheela R



Paul P
Replied On February 6, 2008 02:31 PM UTC

this doesn't work for me.

The complexity of the formula doesn't matter, but this is basically what I do:

in form_load I do:

this.grid[3,3].CellValue = "=sheet2!a1";
this.grid[3,3].CellType = "FormulaCell";

Then I have a timer that does a callback

in the callback after 10 secongs or so I do:
this.grid[3,3].CellValue = "=sheet3!b2";
this.grid[3,3].CellType = "FormulaCell";

but the value in the grid is still the same.
to double check, I even do
this.grid[3,4].CellValue = this.grid[3,3].CellValue
this.grid[3,4].CellType = this.grid[3,3].CellType

and the cell[3,4] actually gets the NEW values, but cell[3,3] keeps the old formula.






SubhaSheela R [Syncfusion]
Replied On February 7, 2008 07:46 AM UTC

Hi Paul,

Thank you for using Syncfusion products.

You can clear the fromula cell value in the cell using ClearCells method of GridControl before resetting the formula.
Below is the code snippet:

this.gridControl2.ClearCells(GridRangeInfo.Cell(3, 4), true);
if (timer1.Interval == 100)
{
this.gridControl2[3, 4].CellType = GridCellTypeName.FormulaCell;
this.gridControl2[3, 4].Text = "=gridControl2!B9";
}


Please refer the sample available in the link below and let me know if it helps:

http://websamples.syncfusion.com//samples/Grid.Windows/F71548FollowUp/main.htm

Regards,
Subhasheela R




Paul P
Replied On February 7, 2008 06:16 PM UTC

Thanks, that worked


SubhaSheela R [Syncfusion]
Replied On February 8, 2008 02:36 AM UTC

Hi Paul,

Thanks for your update.

Regards,
Subhasheela R


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.

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

;