VB2010中DataGridView单元格如何在输入2位数的数据后自动跳到后一格
VB2010中DataGridView单元格如何在输入2位数的数据后自动跳到后一格(相当于自动击打了一次TAB键),到最后一格输入2位数据后自动跳到下一行第一格?请教高手,如何做到?谢谢!
[解决办法]
Private Sub DataGridView1_CellValueChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellValueChanged
If DataGridView1.CurrentCell.Value.ToString.Length = 2 Then
SendKeys.Send("{TAB}")
End If
End Su
[解决办法]
Private Sub DataGridView1_CurrentCellDirtyStateChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGridView1.CurrentCellDirtyStateChanged
If DataGridView1.IsCurrentCellDirty Then
DataGridView1.CommitEdit(DataGridViewDataErrorContexts.Commit)
End If
DataGridView1.CurrentRow.Selected = False
End Sub