如何保留在dataGridView的相同MaskedTextBoxCell中 [英] How to remain in the same MaskedTextBoxCell of a dataGridView
问题描述
大家好,
我使用的是dataGridView
,在按下Enter
时,我想移至同一行上的特定单元格,所以我找到了一种方法来覆盖Form
的ProcessCmdKey
函数.
现在我的dataGridView
中有一个maskedTextBoxColumn
.
在<6>事件如果输入不正确在于messageBox出现与<7>按钮,选择<8>按钮的焦点必须保持在相同的细胞时,但是这永远不会发生.
我按下Yes
按钮时将全局布尔变量设置为false
,ProcessCmdKey
检查布尔变量并保留在同一单元格中.但这也失败了.
请任何人告诉我如何使用此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 inProcessCmdKey
itself, not onCellLeave
. I think, your messagebox appears after the focus is already moved. Without seeing your code, I can offer only this suggesion.
这篇关于如何保留在dataGridView的相同MaskedTextBoxCell中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!