ver:VB6.0
よしと申します。
お世話になります。
DataGridの任意のセルに半角数字のみ入力可能にする方法を
ご教授いただきたいのですが。
Private Sub DataGrid1_KeyPress(KeyAscii As Integer)
If DataGrid1.Columns(.Col).Caption = "ABC" Then
If KeyAscii >= 32 And KeyAscii < 45 Or _
KeyAscii > 57 Or KeyAscii = 47 Then
Beep 'エラー音
KeyAscii = 0 '入力キーを無効にする
End If
End If
End Sub
これで解決しました。
ツイート | ![]() |