Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
600
Formula for GridCell
posted

Hi,

is it possible to put a formula to a wingridcell?

Example: cell.formula = cell("a1") + cell("c4")

Thanks

Hansjörg Wintermantel

  • 29065
    Offline posted

    Hello, 

    Formulas exist on columns only. The only way to do this on a particular cell is by handling InitializeRow, iterate the Cells collection from the event arg "Row", and change the cell's Value. This would make most sense if you are only concerned about values from within the same row as you won't be able to access other rows while in this event, only the one that is being assigned. 

    eg.

    private void UltraGridEdit_InitializeRow(object sender, CellEventArgs e)
    {   
       e.Row.Cells["a0"].Value = e.Row.Cells["a1"].Value + e.Row.Cells["a4"].Value; 
    }