如何保留在dataGridView的相同MaskedTextBoxCell中 [英] How to remain in the same MaskedTextBoxCell of a dataGridView

查看:109
本文介绍了如何保留在dataGridView的相同MaskedTextBoxCell中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我使用的是dataGridView,在按下Enter时,我想移至同一行上的特定单元格,所以我找到了一种方法来覆盖FormProcessCmdKey函数.

现在我的dataGridView中有一个maskedTextBoxColumn.
在<6>事件如果输入不正确在于messageBox出现与<7>按钮,选择<8>按钮的焦点必须保持在相同的细胞时,但是这永远不会发生.
我按下Yes按钮时将全局布尔变量设置为falseProcessCmdKey检查布尔变量并保留在同一单元格中.但这也失败了.

请任何人告诉我如何使用此MaskedTextBoxCell.

预先感谢,
:)

Hi all,

I was using a dataGridView where on pressing Enter I want to move to a specific cell on the same row I found a way for overriding the ProcessCmdKey function of the Form .

Now I have a maskedTextBoxColumn in my dataGridView .
In the CellLeave event if the input was not correct a messageBox appear with YesNo buttons,when choosing the Yes Button the focus must remain in the same cell , but this never happen .
I set a global boolean variable as false on pressing Yes button, the ProcessCmdKey check the boolean variable and remain in the same cell. But also this failed.

Please can anyone tell me how can I act with this MaskedTextBoxCell.

Thanks in advance,
:)

推荐答案

尝试在ProcessCmdKey本身而不是CellLeave上使用消息框.我想,您的消息框将在焦点已移动后出现.在看不到您的代码的情况下,我只能提供这种建议.
Try to use the messagebox in ProcessCmdKey itself, not on CellLeave. I think, your messagebox appears after the focus is already moved. Without seeing your code, I can offer only this suggesion.


这篇关于如何保留在dataGridView的相同MaskedTextBoxCell中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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