I'm developing a win forms app, in which there is a DataGridView which has been binded to a DataTable. The DataTable has been applied unique constrain on its EAN field. When a new entry is made with same EAN data, following exception is thrown(As shown in picture).
I want to handle that exception and display some different message and perform some actions, But the problem is I'm Not able to figure out from where is that exception being thrown.
Tried setting break points on various part of the code, where it might occur, also tried wrapping up various part of code into try catch. This exception is not even touching code.(Might be some event issue, I guess!)
try
{
Product_dataGridView.UserAddedRow += Management_dataGridView_UserAddedRow;
Product_dataGridView.UserDeletedRow += Product_dataGridView_UserDeletedRow;
}
catch (Exception exe)
{
MessageBox.Show(exe.Message);
}