Click here to Skip to main content
15,916,378 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I have a TextBox and a DataGridView which is bound to a DataTable in a windows form application.

Some cells in the DataGridView are mandatory so when the user wants to leave a row, in RowValidating event handler the program checks if the current row is dirty and the mandatory cells do not have value,a message is shown and validation is canceled.

When I insert a row into the datagridview,click somewhere on the datagridview,return to the newly inserted row,change some values of the row(ex:empty mandatory cells) and then press Esc,changes are discarded and the old values are restored.But the problem is when I insert a row into the datagridview,click on the TextBox ,change some values of the row(ex:empty mandatory cells) and then press Esc,old values are not restored,and current row is not dirty,so the user leaves the row successfully without filling in the mandatory cells.
How should I fix this problem?

Thanks
Posted

1 solution

pls go thru this link,would help your problem..

Esckey
 
Share this answer
 
Comments
shadi2007 14-Dec-11 4:25am    
Thanks but I don't think the link is relevant to my question.By catching the Esc key in those methods how can I solve my problem?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900