Datagrid validation problem

R

Rob

I currently use the datatable.ColumnChanging event to call
my data validation method in a bound datagrid (Windows not
Web). This is causing me problems since the user must
click away from the datagrid or select another cell to run
the validation.

Is there another way to call the validate of a bound
datagrid that begins when the user first starts to type
rather than when the cell is changed or the datagrid loses
focus?

Any help in this will be greatly appreciated.

Rob
 
A

Aiwen Guo [MSFT]

Hey, Rob:

This columnChanging events will only be fired when you try to commit the
change to the Dataset, by typing in the grid can't get this event to fire,
you have to move the focus to another cell to try to commit the change.

I am not sure how you want to validate when the user just starts to type,
If the validation starts at the beginning of an input typing, how can you
know what the proposed value is? if it's like a permission check, you can
try to set the readonly property of the column so the user won't be able to
input new values.

Thanks.

Aiwen
VB Data Team
This posting is provided "AS IS" with no warranties, and confers no rights.
 
D

Dmitriy Lapshin [C# / .NET MVP]

Hi all in the thread,

One can inherit from DataGridTextBoxColumn and subscribe to the hosted text
box's TextChanged event to perform instant input validation (for example,
when only alphanumeric characters should be allowed).
 

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

Similar Threads


Top