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

Saving the result of a formula...

(Using v2.1.0.9) I have non-databound, non-virtual grid. When the user edits a number in cell A1, I want to capture the result of the formula in cell A2. The formula in A2 *is* recalculating, and displays the correct value; however, I do not know what event to use to persist calculated value to the database. Based on some old forum posts, it seemed like SaveCellInfo would be the ticket. I used something like: AddHandler Me.GridControl1.SaveCellInfo, AddressOf Me.GridControl1_SaveCellInfo However, this event does not seem to fire when the value in A2 is recalculated. (When I test the grid, I can see the new value displayed, but my SaveCellInfo does not get fired). Please tell me what am I doing wrong??! Thanks, s.s.

1 Reply

AD Administrator Syncfusion Team December 29, 2004 06:54 AM UTC

This code works for me to show the changes in the output window if I drop a GridControl on the form and add these handlers.
Private Sub Form1_Load(sender As Object, e As System.EventArgs)
   Me.gridControl1.TableStyle.CellType = "FormulaCell"
   Me.gridControl1(1, 1).Text = "4"
   Me.gridControl1(1, 2).Text = "= A1 * 2"
   AddHandler Me.gridControl1.SaveCellInfo, AddressOf grid_SaveCellInfo
End Sub ''Form1_Load

Private Sub grid_SaveCellInfo(sender As Object, e As GridSaveCellInfoEventArgs)
   If Not (e.Style.FormulaTag Is Nothing) Then
      Console.WriteLine("compute value at ({0},{1}) = {2}", e.RowIndex, e.ColIndex, e.Style.FormulaTag.Text)
   End If
End Sub ''grid_SaveCellInfo

Live Chat Icon For mobile
Up arrow icon