DataGridView Validation Problem!

  • Thread starter Thread starter David Morgenlender
  • Start date Start date
D

David Morgenlender

I have implemented a custom date control; it's a UserControl containing a
MaskedTextBox control. I have created a DataGridView custom column using this
UserControl.

DataGridView is very demanding of its custom column controls. But I have
finally modified the UserControl so it mostly works correctly, except for one
major problem. When a cell loses focus (via tab, enter, etc.), the DataGridView
gets the control's value (via a get of EditingControlFormattedValue) BEFORE the
MaskedTextBox raises the TypeValidationCompleted event. Since the app is
required to prevent leaving the UserControl unless there is a valid date value,
the app does not expect to be able to retrieve an invalid value. But since the
validation occurs too late when in a grid, the value is retrieved before it is
ready. To make a long story short, this appears to be a serious (at least for
many uses) bug in the DataGridView.

Trying to have the UserControl do special validation in this case leads to some
pretty convoluted logic! Can you suggest any clean way to prevent this problem
from occurring?

Dave

=======================================================
Dave Morgenlender
e-mail: (e-mail address removed)
=======================================================
 
Hi David

I have added a reply to you in
microsoft.public.dotnet.framework.windowsforms.controls newsgroup, please
check it there, I will follow up with you. Thanks

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