查看: 40  |  回复: 0
VB6 只能在TextBox中输入数字
楼主
发表于 4月10日 23:21

新建From1(窗体),新建Text1(TextBox),Command1(按钮CommandButton),代码:

Private Sub Text1_KeyPress(KeyAscii As Integer)
    '只能输入数字
    If KeyAscii < 48 Or KeyAscii > 57 Then
        KeyAscii = 0
    End If
End Sub


您需要登录后才可以回帖 登录 | 立即注册
【本版规则】请勿发表违反国家法律的内容,否则会被冻结账号和删贴。
用户名: 立即注册
密码:
2020-2024 MaNongKu.com