Determining when value changed in DataGridViewCell from derived cl

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am not seeing a clean way from a derived DataGridViewCell to determine when
the value is changed. The value changed event gets thrown in the
DataGridView not the cell. What am I missing?
 
A little late but would this be what you are after?

Private Sub DataGridView1_CellValidating(ByVal sender As Object, ByVal e
As System.Windows.Forms.DataGridViewCellValidatingEventArgs) Handles
DataGridView1.CellValidating
Dim CurrentCell As DataGridViewCell =
DataGridView1.Item(e.ColumnIndex, e.RowIndex)

If CurrentCell.IsInEditMode Then
Dim GridControl As Control = DataGridView1.EditingControl
Console.WriteLine("------------------------------------")
Console.WriteLine("Edited value ""{0}"" Former value ""{1}""",
GridControl.Text, DataGridView1.Item(e.ColumnIndex,
e.RowIndex).Value.ToString)
Console.WriteLine("------------------------------------")
End If
End Sub
 
Thanks for the response Kevin. Your example is using an event in the
DataGridView.
I am writing a custom DataGridViewCell and I was trying to determine when
the value in my cell was changed.
 
Back
Top