Odd datagridview behavior with bindingsource

I have a datagridview bound with a bindingsource to a dataset datatable.

I have a datagridview button on the grid called "delete" but rather than deleting I just mark a column bound to a field called "deleted." The bindingsource.filter = "deleted=0" and that works great. As I click the button, my code sets the associated deleted cell to "1" and the row drops off the datagridview as a result of the binding filter.

It works great until there is only one row of data and I click the "delete" button. While it behaves as if it works, when I try to update the datatable then, I get a null exception and I look back at the datagridview and it has a "new" record with no data in it that I did not create.

What the heck? Anyone know what's going on? Code follows:

Private SubDataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
If e.RowIndex > -1 Then
If e.ColumnIndex = 6 Then
If MsgBox("Are you sure?", MsgBoxStyle.YesNo, "Deleting Lot") = MsgBoxResult.Yes Then
Dim keys(0) As DataColumn
keys(0) = Me.MyDataset.MyTable.recordIdColumn
Me.MyDataset.MyTable.PrimaryKey = keys
Dim row As MyApp.MyDataSet.MyTableRow = Me.MyDataSet.MyTable.Rows.Find(Me.DataGridView1.Rows(e.RowIndex).Cells("recordid").Value)
row.deleted = 1
row.syncdate = Now()
If IsPortable Then
row.syncflag = 1
End If
row.updatedby = MyApp.userRecordID
row.updateddate = Now()
Me.MyTableAdapter.Update(Me.MyDataset.MyTable)
Me.MyTableBindingSource.ResetBindings(False)
End If
End If
End If

[1756 byte] By [justdavid] at [2008-1-4]
# 1
When you go to the add new row of a datagridview the datagridview creates a new datarow to be added to the dataset. Well once you delete all the rows a add new row is automatically created. Once the user moves off the row the new row will be added to the data table. The row is not added until then to prevent data errors like null values in columns which do not accept nulls.
KenTucker at 2007-10-3 > top of Msdn Tech,Windows Forms,Windows Forms Data Controls and Databinding...