7,763
社区成员
发帖
与我相关
我的任务
分享
Private Sub DataGrid1_KeyPress(KeyAscii As Integer)
If DataGrid1.Col = 2 Then
If KeyAscii = Asc(".") And InStr(DataGrid1.Text, ".") Then
KeyAscii = 0
Else
KeyAscii = Numeric_Only(KeyAscii)
End If
End If
End Sub
Private Function Numeric_Only(KeyAscii As Integer)
Select Case KeyAscii
Case Asc("0") To Asc("9"), Asc(".")
Numeric_Only = KeyAscii
Case Else
Numeric_Only = 0
End Select
End Function