| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1377 人关注过本帖
标题:身份证输入框的事件,用keyUp好还是keyPress好?
取消只看楼主 加入收藏
不懂才问
Rank: 15Rank: 15Rank: 15Rank: 15Rank: 15
来 自:大草原
等 级:贵宾
威 望:29
帖 子:1503
专家分:6593
注 册:2010-7-5
结帖率:91.53%
收藏
已结贴  问题点数:20 回复次数:1 
身份证输入框的事件,用keyUp好还是keyPress好?
Private Sub Text1_KeyPress(KeyAscii As Integer)
    If KeyAscii = 8 Then Exit Sub
    If KeyAscii = 13 Then Exit Sub
    If KeyAscii = 88 Then Exit Sub
    If KeyAscii = 120 Then Exit Sub
    If KeyAscii > 57 Or KeyAscii < 48 Then KeyAscii = 0
End Sub

或者

Private Sub Text1_KeyPress(KeyAscii As Integer)
    If KeyAscii = 8 or KeyAscii = 13 or KeyAscii = 88 or KeyAscii = 120 Then Exit Sub
    If KeyAscii > 57 Or KeyAscii < 48 Then KeyAscii = 0
End Sub

身份证输入框的事件,用keyUp好还是keyPress好?
搜索更多相关主题的帖子: Exit If Sub Then 身份证 
2021-05-08 07:53
不懂才问
Rank: 15Rank: 15Rank: 15Rank: 15Rank: 15
来 自:大草原
等 级:贵宾
威 望:29
帖 子:1503
专家分:6593
注 册:2010-7-5
收藏
得分:0 
回复 2楼 apull
解释的非常详细,一下就懂了。非常感谢

报告老师,我低头不是因为我在装低调,是你问的问题,我真的不会答,,,
2021-05-09 14:32
快速回复:身份证输入框的事件,用keyUp好还是keyPress好?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011584 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved