VB输入限制功能一例:只允许输入汉字,本实例只允许用户输入汉字,如果输入其它类型的字符,程序将不允许输入,且会提醒用户。原理是获取键盘上的ASCII值,并判断是否在中文汉字的范围,若不在,就禁止输入。实现本功能的关键代码,分享给大家:
If KeyAscii > 0 And KeyAscii <> 13 And KeyAscii <> 8 Then
KeyAscii = 0
MsgBox "只允许输入汉字!", 48, "提示"
End If
因为是对键盘的控制实现对输入的限制,因此若鼠标复制了一段包含其它字符的文字,则程序无能为力,因为鼠标不在监控范围。
SHOW FULL COLUMNS FROM `jrk_downrecords` [ RunTime:0.000909s ]
SELECT `a`.`aid`,`a`.`title`,`a`.`create_time`,`m`.`username` FROM `jrk_downrecords` `a` INNER JOIN `jrk_member` `m` ON `a`.`uid`=`m`.`id` WHERE `a`.`status` = 1 GROUP BY `a`.`aid` ORDER BY `a`.`create_time` DESC LIMIT 10 [ RunTime:0.080883s ]
SHOW FULL COLUMNS FROM `jrk_tagrecords` [ RunTime:0.004947s ]
SELECT * FROM `jrk_tagrecords` WHERE `status` = 1 ORDER BY `num` DESC LIMIT 20 [ RunTime:0.001626s ]
SHOW FULL COLUMNS FROM `jrk_member` [ RunTime:0.000993s ]
SELECT `id`,`username`,`userhead`,`usertime` FROM `jrk_member` WHERE `status` = 1 ORDER BY `usertime` DESC LIMIT 10 [ RunTime:0.003172s ]
SHOW FULL COLUMNS FROM `jrk_searchrecords` [ RunTime:0.000858s ]
SELECT * FROM `jrk_searchrecords` WHERE `status` = 1 ORDER BY `num` DESC LIMIT 5 [ RunTime:0.003913s ]
SELECT aid,title,count(aid) as c FROM `jrk_downrecords` GROUP BY `aid` ORDER BY `c` DESC LIMIT 10 [ RunTime:0.016227s ]
SHOW FULL COLUMNS FROM `jrk_articles` [ RunTime:0.001148s ]
UPDATE `jrk_articles` SET `hits` = 2 WHERE `id` = 294512 [ RunTime:0.022535s ]