I have a problem that adding a new ROW with duplicate UNIQUE id throws CONSTRAINTException that I cannot always catch.. Randomly general exception halts my VB software, sometimes catching works. here is my code.
Private Sub BindingNavigatorAddNewItem_MouseUp()
try
DataGridView1.CurrentRow.Cells(0).Value = InputBox("give new product id")
Catch ex As Exception
MessageBox.Show("error ") <-- never comes here!!
End Try
end sub
Private Sub DataGridView1_DataError(..) Handles DataGridView1.DataError
e.ThrowException = False <-- randomly comes here!!
Dim v As DataGridView = CType(sender, DataGridView)
v.Rows(e.RowIndex).Cells(e.ColumnIndex).ErrorText = "The value is wrong"
v.BeginEdit(False)
MessageBox.Show("error 2")
end sub