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

Custom formulas not updating

Hi, I have the requirement to have some formula cells directly reference other formula cells which contain some string value (which is the product of a custom function that I use). For example I need the value that is stored in cell A3 "XYZ" to be displayed in B4 and C5. I would like to be able to put the Excel functionality equivalent in B4 and C5 which would be =A3. This obviously doesn’t work in the current grid, so I have added a custom function which retrieves the referenced cell''s FormattedText. B4 and C5 do not update when A3 is changed however (unlike all of the native formulas which automatically update themselves). Is there a way to give my custom formula this same behaviour? Will you be adding string support to the formula engine? eg. ="The cost is: " & B4 & " thousand dollars" Please see the example for more info... example_5114.zip

1 Reply

AD Administrator Syncfusion Team October 18, 2004 07:18 PM UTC

If you call the GetValueFromArgs method, it will allow the grid to properly track the dependent cells.
Public Function Evaluate_Str(ByVal args As String) As String
        Dim c As Integer
        Dim r As Integer
        Try
            ReturnGridRefFromString(args, c, r)
            Dim cellModel As GridFormulaCellModel
            cellModel = Me.grd.CellModels("FormulaCell")
            cellModel.Engine.GetValueFromArg(args)
            Return grd(r, c).FormattedText
        Catch ex As System.Exception
            Return "!! ERROR !!"
        End Try
    End Function

Loader.
Live Chat Icon For mobile
Up arrow icon