Esc键的datagridview问题 [英] datagridview problem with Esc key

查看:143
本文介绍了Esc键的datagridview问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我有一个TextBox和一个DataGridView,它绑定到Windows窗体应用程序中的DataTable.

DataGridView中的某些单元格是强制性的,因此,当用户要离开行时,该程序在RowValidating事件处理程序中检查当前行是否脏,并且强制性单元格没有值,显示一条消息,并取消验证.

当我在datagridview中插入一行时,单击datagridview上的某个位置,返回到新插入的行,更改该行的某些值(例如:空的必填单元格),然后按Esc键,放弃更改并恢复旧值.但是问题是当我在datagridview中插入一行时,单击TextBox,更改该行的某些值(例如:空的强制性单元格),然后按Esc键,旧值不会恢复,并且当前行不脏,所以用户无需填写必填单元格即可成功离开该行.
我应该如何解决此问题?

谢谢

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

推荐答案

pls通过此链接,将帮助您解决问题..

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

Esckey


这篇关于Esc键的datagridview问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆