Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2006

Tip: Looking for answers? Try searching our database.

DataGridViewDataErrorEventArgs ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Asaf - 09 Feb 2006 16:15 GMT
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
"Jeffrey Tan[MSFT]" - 10 Feb 2006 08:42 GMT
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
Signature

Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Asaf - 10 Feb 2006 12:18 GMT
Hi Jeffrey,

Thanks for your help :-)

Regards,
Asaf

> Hi Asaf,
>
[quoted text clipped - 19 lines]
> Get Secure! - www.microsoft.com/security
> This posting is provided "as is" with no warranties and confers no rights.
"Jeffrey Tan[MSFT]" - 13 Feb 2006 01:59 GMT
You are welcome

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Signature

Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.