在键盘键上的Datagridview当前单元格中添加日期按

时间:2014-05-27 14:26:16

标签: vb.net

如何在Datagridview中添加添加日期键盘上的当前单元格按vb

我的代码

        Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        KeyPreview = True
    End Sub
 Private Sub Form1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles Me.KeyPress
        'when you press the Enter key,invoke the method( you can remove it)
        If Keys.S And Convert.ToString(DataDataGridView.CurrentRow.Cells(4).Value) = ("S".ToString) Then
            'add the code about changing the data
            DataDataGridView.CurrentRow.Cells(4).Value = vbNullString
            DataDataGridView.CurrentRow.Cells(4).Value = TimeOfDay
        End If
    End Sub
End Class

不工作......

当我在单元格4中写入S时,则不添加日期和时间

0 个答案:

没有答案