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

Set Formula for an entire column

Thread ID:





63087 Jun 27,2007 11:13 PM UTC Jun 27,2007 11:22 PM UTC WinForms 1
Tags: GridControl
Richard Bysouth
Asked On June 27, 2007 11:13 PM UTC

If I want a column to use the same formula for all rows, adjusted by row number, what is the most efficient way to do this?
For example
B1 =A1 * 10
B2 =A2 * 10

I am using the following code at present but wondered whether there is a better way? Maybe using relative refs?

With Me.GridControl1
.ColStyles(2).CellType = "FormulaCell"

Dim engine As GridFormulaEngine = CType(.CellModels("FormulaCell"), GridFormulaCellModel).Engine

For rowIndex As Integer = .Rows.HeaderCount To .RowCount - 1
Me.GridControl1(rowIndex + 1, 2).CellValue = engine.AdjustReferences("=A1 * 10", rowIndex, 0)

End With



haneefm [Syncfusion]
Replied On June 27, 2007 11:22 PM UTC

Hi Richard,

You can handle the QueryCellInfo event and set the cellvalue of the formulcell there .Below are the code snippet

if e.ColIndex == 2 AND e.RowIndex > 0 Then
Dim engine As GridFormulaEngine = CType(e.Style.CellModel, GridFormulaCellModel).Engine
e.Style.CellValue = engine.AdjustReferences("=A1 * 10", e.RowIndex -1 , 0)

Best regards,


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