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?

Re: Determining when value changed in DataGridViewCell from derived cl by Kevin

Kevin
Wed Jun 27 15:43:13 CDT 2007

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

"Oldman" <Oldman@discussions.microsoft.com> wrote in message
news:525425B9-AD8B-4B24-8389-C8F6E84B34EB@microsoft.com...
>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?



Re: Determining when value changed in DataGridViewCell from derive by Oldman

Oldman
Wed Jun 27 15:56:05 CDT 2007

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.

"Kevin S Gallagher" wrote:

> 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
>
> "Oldman" <Oldman@discussions.microsoft.com> wrote in message
> news:525425B9-AD8B-4B24-8389-C8F6E84B34EB@microsoft.com...
> >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?
>
>
>