I had asked how to check to see if a cell in a datagridview was changed so I could prompt the user if they wanted to save the changes. The solution was to set the value of a global variable "CellBegin" (which I store as a string) with the cell contents on the begin edit and then compare it on the cell end edit. It works very nicely for existing rows in the data. However, as soon as I begin to enter a new record I get the following error message:
Conversion from type 'DBNull' to type 'String' is not valid.
Should I change the variable to something other than a string (variant?). Or is there a way to recognize this entry is a new record and then bypass the compare? Hope I'm making sense.
Private Sub DataGridView1_CellBeginEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellCancelEventArgs) Handles DataGridView1.CellBeginEdit
CellBegin = Me.DataGridView1.CurrentCell.Value