PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
DataGridViewDataErrorEventArgs ?
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
DataGridViewDataErrorEventArgs ?
![]() |
DataGridViewDataErrorEventArgs ? |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hi,
For the "DataError" event of the DataGridView I would like to catch the "ConstraintException" when there is an error but I havent figure it out how to do it with e.Exception of DataGridViewDataErrorEventArgs. Thanks in advanced for any help, Regards, Asaf |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Hi Asaf,
Thanks for posting. Regarding this issue, we can use C# "is" operator to determine if e.Exception is of type ConstraintException. Code snippet listed below: if ((e.Exception) is ConstraintException) { DataGridView view = (DataGridView)sender; view.Rows[anError.RowIndex].ErrorText = "an Constraint error"; view.Rows[anError.RowIndex].Cells[e.ColumnIndex].ErrorText = "an Constraint error"; e.ThrowException = false; }//what ever statement you like Hope this helps! Best regards, Jeffrey Tan Microsoft Online Partner Support Get Secure! - www.microsoft.com/security This posting is provided "as is" with no warranties and confers no rights. |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Hi Jeffrey,
Thanks for your help :-) Regards, Asaf ""Jeffrey Tan[MSFT]"" wrote: > Hi Asaf, > > Thanks for posting. > > Regarding this issue, we can use C# "is" operator to determine if > e.Exception is of type ConstraintException. Code snippet listed below: > > if ((e.Exception) is ConstraintException) > { > DataGridView view = (DataGridView)sender; > view.Rows[anError.RowIndex].ErrorText = "an Constraint error"; > view.Rows[anError.RowIndex].Cells[e.ColumnIndex].ErrorText = "an > Constraint error"; > e.ThrowException = false; > }//what ever statement you like > > Hope this helps! > > Best regards, > Jeffrey Tan > Microsoft Online Partner Support > Get Secure! - www.microsoft.com/security > This posting is provided "as is" with no warranties and confers no rights. > > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
You are welcome
Best regards, Jeffrey Tan Microsoft Online Partner Support Get Secure! - www.microsoft.com/security This posting is provided "as is" with no warranties and confers no rights. |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

