DataGridView Validation Problem!

  • Thread starter David Morgenlender
  • 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)
=======================================================
 
J

Jeffrey Tan[MSFT]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top