以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]退格键不能用  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=177516)

--  作者:2425004926
--  发布时间:2022/5/25 15:32:00
--  [求助]退格键不能用
\'文本框KeyPress事件,只输入数字,第一位不能为0
Dim s As Boolean
If Char.IsNumber(e.KeyChar) Then
    If e.sender.text = "" And e.KeyChar = "0" Then
        e.Cancel  = True
    End If
Else
    e.Cancel  = True
End If

\'\'以上代码为何back退格键不能用
[此贴子已经被作者于2022/5/25 15:34:28编辑过]

--  作者:有点蓝
--  发布时间:2022/5/25 15:45:00
--  
Dim s As Boolean
If Char.IsNumber(e.KeyChar) Then
    If e.sender.text = "" And e.KeyChar = "0" Then
        e.Cancel  = True
    End If
Elseif Char.IsControl(e.KeyChar) = false
    e.Cancel  = True
End If

--  作者:2425004926
--  发布时间:2022/5/25 16:13:00
--  
谢谢老师!!!