學生資訊管理系統 優化篇(1)

2021-08-28 15:55:03 字數 2155 閱讀 7725

1.輸入數字和刪除鍵

private sub txtsid_keypress(keyascii as integer)

if keyascii <> 8 and (keyascii < 48 or keyascii > 57) then

keyascii = 0

end if

end sub

2.輸入中英文及刪除鍵

private sub txtname_keypress(keyascii as integer)

if ((keyascii <= -3652 and keyascii >= -20319) or (keyascii >= 65 and keyascii <= 90) or (keyascii >= 97 and keyascii <= 122) or keyascii = 32 or keyascii = 8) = false then

keyascii = 0

end if

end sub

3.如何限制本文本元長度

private sub txtaddress_keypress(keyascii as integer)

txtaddress.maxlength = 25

end sub

4.只能輸入數字和英文本母

private sub txtpassword1_keypress(index as integer, keyascii as integer)

if ((keyascii >= 48 and keyascii <= 57) or (keyascii >= 65 and keyascii <= 90) or (keyascii >= 97 and keyascii <= 122) or keyascii = 8) = false then keyascii = 0

end sub

5.日期的判斷

dim borndate as date

dim rudate as date

borndate = trim(txtborndate.value)

rudate = trim(txtrudate.value)

if rudate <= borndate then '進行比較

msgbox "還未出生就入學了,這麼神奇?", vbokonly + vbinformation, "警告"

txtrudate.setfocus

exit sub

end if

利用vb中的dtpicker,是慧慧告訴我的,當時我還好鬱悶的,想了老半天,怎麼才能實現自選日期呢,原來有控制項呀!

新增過程:工具→部件→控制項→microsoft windows common control2.6.0→應用→確定

這個控制項與文字框不同之處在於它是用value屬性,因為這個當時還不知道怎麼回事兒呢,發現在後面加上.後,沒有text屬性,這才明白了,人家本來就不是文字框呀。

6.登陸次數限定

if micount = 1 then

exit sub

end if

if micount = 2 then

exit sub

end if

if micount = 3 then

endend if

txtpassword.setfocus

txtpassword.text = ""

end if

1.空字元,

private sub comboclassno_keypress(keyascii as integer)

keyascii = 0

end sub

2.修改資訊時,未編輯狀態下,按鈕不可弄

comboexamtype.enabled = false

comboclassno.enabled = false

combosid.enabled = false

combocourse.enabled = false

txtname.enabled = false

txtresult.enabled = false

學生資訊管理系統小結 優化篇

學生資訊管理系統 一 是遇到的問題,除錯後能執行。而執行不是目的,讓使用者喜歡才是目的。所以我們要優化我們的系統。開始很信任 給的原始碼,其實只要你知識豐富了些或思考了,就發現有很多不對的地方。1.日期新增方式自動轉換 txtrudate.text replace txtrudate,txtruda...

學生資訊管理系統優化(一)

任何的系統在完成之前必須得優化,首先你的保證你做出來的軟體得沒有正常的邏輯問題,還得提高使用者體驗,讓別人用著比較舒服對吧!所以優化就是乙個不斷完善的過程!下邊我為大家分享一下我的優化心得!1.登入介面 首先你的保證你的登入介面不能隨意亂輸入,控制字元長度,而且要注意特殊字元的問題,防止別人輸入特殊...

學生資訊管理系統優化限制

if keyascii 8 then exit sub if keyascii 48 or keyascii 57 then keyascii 02,限制貼上 if keycode vbkeyv and shift vbctrlmask then txtpassword.enabled false ...