Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Dirty value of datagridview cell

27 views
Skip to first unread message

Morten Snedker

unread,
Mar 22, 2006, 5:36:32 AM3/22/06
to
How do I the value of a cell in a datagridview, before it is updated?

I wish to validate the "visible" value, not the actual value (cell/row
hasn't been updated yet).


Thanks in advance.

/Snedker

Ken Tucker [MVP]

unread,
Mar 23, 2006, 5:31:12 AM3/23/06
to
Hi,

Use the cell validating event

Private Sub DataGridView1_CellValidating(ByVal sender As Object, ByVal e
As System.Windows.Forms.DataGridViewCellValidatingEventArgs) Handles
DataGridView1.CellValidating
Dim strOld As String = DataGridView1.Item(e.ColumnIndex,
e.RowIndex).Value.ToString
Dim strNew As String = e.FormattedValue.ToString

Trace.WriteLine(String.Format("Old Value {0} {1}New Value {2}",
strOld, ControlChars.NewLine, strNew))
End Sub

Ken
--------------------
"Morten Snedker" <morten_spammenot_ATdbconsult.dk> wrote in message
news:di9222tqtcqvn1is7...@4ax.com...

0 new messages