有Backspce相对应的ASCII码吗?请问高手,如何实现在输入时只能敲数字键和退格键!!
解决方案 »
- 查询数据库问题
- 下拉菜单怎样加载txt文件内容
- 急求:Winsock控件的TCP/IP协议设计局域网上多台客户机向同一服务器发送字符串的代码
- ODBC与AD0
- SETUP FACTORY 安装的问题
- 查询出的内容怎样打印到设计好的水晶报表中呢?
- 有什么方法让combobox控件里的文本不可编辑?
- 在代码中如何判断出MDB数据库中是否存在某个表(着急阿!!!)
- Command Line Args Windows中的好多文件(比方说*.txt)双击之后可以直接启动相应的应用程序并用这个应用程序打开,请问这个怎么做到?(
- 如何得到RecordSet中记录的条数????谢谢
- 为什么在我的vb6中没有Microsoft Active Server Pages Object Library部件。
- 如何实现网络数据的拷贝
If IsNumeric(Chr(KeyAscii)) = False And KeyAscii <> 8 Then
KeyAscii = 0
End If
End Sub
Private Sub Form_Load()
Me.KeyPreview = True
End SubPrivate Sub Text1_KeyPress(KeyAscii As Integer)
If Not InStr("1234567890" & Chr(8), Chr(KeyAscii)) > 0 Then KeyAscii = 0
End Sub
Select Case KeyAscii
Case Asc("-") '不允许负数
KeyAscii = 0
Case 8 '无变化,退格键不屏蔽
Case Asc(" ") '不允许空格
KeyAscii = 0
Case Asc(".") '46 '不允许小数点
KeyAscii = 0
Case Is < Asc(0) '48
If KeyAscii <> vbKeyReturn Then KeyAscii = 0
Case Is > Asc(9) '57
KeyAscii = 0
End Select Exit Sub
End Sub
If ((KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 8 And KeyAscii <> 9) Then
KeyAscii = 0
End If
End Sub
If Not (KeyAscii = 8 Or (KeyAscii >= 48 And KeyAscii <= 57)) Then KeyAscii = 0
End Sub