1、数字のみを入力することができます
If keyascii = 8 then exit sub
If keyascii <48 or keyascii > 57 then keyascii = 0
2、限界ペースト
If keycode = vbkeyv and shift =vbctrlmask then
Txtpassword. Enabled = false
Clipboard.clear
Txtpassword.enabled = true
End if
図3は、特殊文字、数字、スペース、文字のみまたは文字を制限します
Private sub txtcoursename_keypress(keyascii as integer)
If keyascii < 0 or keyascii = 8 or keyascii = 13 then
Elseif not chr(keyascii) like "[a-zA-Z]" then
Keyascii = 0
End if
End sub
4、ヒントパスワードの残りの数、パスワードは、ユーザーを思い出させるために、3回入力することができます
If miCout = 1 Then
MsgBox "您还有两次机会!", 48, "警告"
Exit Sub
End If
If miCout = 2 Then
MsgBox "您还有一次机会!", 48, "警告"
Exit Sub
End If
If miCout = 3 Then
MsgBox "即将关闭程序!", 48, "警告"
Me.Hide
End If
Exit Sub
誕生日よりも早く学校に5、
dim borndate as date
dim getdate as date'定义变量'
borndate = trim(txtborndate.text)
getdate = trim(txtborndate.text)
If getdate<=borndate then'进行比较
MsgBox"入学时间不能早于出生时间,请重新输入",vbOKOnly + vbInformation,"警告" txtRudate.SetFocus
Exit Sub
End If
図6に示すように、長さの文字を制限します
プロパティバーに十分な変化を見つけるMAXLENGTH