Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer) 
     If KeyCode = vbKeyDelete Then 
     KeyCode = 0 
     End If 
    End Sub 
     
    Private Sub Text1_KeyPress(KeyAscii As Integer) 
     If KeyAscii = vbKeyBack Then 
     KeyAscii = 0 
     End If 
    End Sub 
     
    相关问题： 
    QA002708 “如何避免在文本框中敲入回车键时，系统发出“滴”的烦人的响声” 
     
    xzb问： 
    操作系统: win98 
    编程工具: vb6.0 
    问题: 为了使文本框只接受数值，我用以下程序段作了限制： 
    Sub Text1_KeyPress (keyascii As Integer) 
     If keyascii < 48 Or keyascii > 57 Then 
     keyascii = 0 
     End If 
    End Sub 
    问题：现在我不能输入小数，只能输入整数，我该么办？请求帮助！ 
    答：你可以这样修改： 
    Sub Text1_KeyPress (keyascii As Integer) 
     If (keyascii < 48 Or keyascii > 57) And KeyAscii <> "." Then 
     keyascii = 0 
     End If 
    End Sub 
<END>