PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Framework Forms DataGridViewDataErrorEventArgs ?

Reply

DataGridViewDataErrorEventArgs ?

 
Thread Tools Rate Thread
Old 09-02-2006, 04:15 PM   #1
=?Utf-8?B?QXNhZg==?=
Guest
 
Posts: n/a
Default DataGridViewDataErrorEventArgs ?


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

  Reply With Quote
Old 10-02-2006, 08:42 AM   #2
Jeffrey Tan[MSFT]
Guest
 
Posts: n/a
Default RE: DataGridViewDataErrorEventArgs ?

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.

  Reply With Quote
Old 10-02-2006, 12:18 PM   #3
=?Utf-8?B?QXNhZg==?=
Guest
 
Posts: n/a
Default RE: DataGridViewDataErrorEventArgs ?

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.
>
>

  Reply With Quote
Old 13-02-2006, 01:59 AM   #4
Jeffrey Tan[MSFT]
Guest
 
Posts: n/a
Default RE: DataGridViewDataErrorEventArgs ?

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.

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off