戻る
Private Sub Text1_KeyPress(KeyAscii As Integer) '押されたキーがBackSpace、Enter以外の場合で、 If KeyAscii <> vbKeyBack And KeyAscii <> vbKeyReturn Then 'キーコードの値が"48"(0)から"57"(9)以外の入力があったときは、 If KeyAscii < 48 Or KeyAscii > 57 Then '警告音を鳴らして、 Beep 'キー操作を取り消します。 KeyAscii = 0 End If End If End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
'押されたキーがBackSpace、Enter以外の場合で、 If KeyAscii <> vbKeyBack And KeyAscii <> vbKeyReturn Then 'キーコードの値が"48"(0)から"57"(9)以外の入力があったときは、 If KeyAscii < 48 Or KeyAscii > 57 Then '警告音を鳴らして、 Beep 'キー操作を取り消します。 KeyAscii = 0 End If End If
End Sub