IDC billing system summary (login interface)
The data room charging system is complete, but the summary and accumulation of learning have just begun. To build a system, we need to accumulate experience. The whole system has many ideas that we need to use at any time, these are all accumulated in summary. login interface. the entire process is divided into several levels
Verify whether it is empty
Verify if the number of logins exceeds the limit
Verify that the user name exists
The code used to verify the correct password is as follows:
Private sub cmdok_click () dim intcounts as integer 'is used to save the number of user request verifications dim objrst as recordset dim strsql as string' to determine whether the input box is empty if trim (txtuserid. text) = "" Then msgbox "Enter the user name", vbokonly + vbexclamation, "prompt" txtuserid. setfocus exit sub end if trim (txtpwd. text) = "" Then msgbox "enter the password", vbokonly + vbexclamation, "prompt" txtpwd. setfocus exit sub end if intcounts = intcounts + 1 'count logon times if intcounts> maxl Ogintimes then': Check whether the number of logins has exceeded the limit msgbox "the number of logins has exceeded the limit! ", Vbcritical," warning "End else 'check whether the specified user strsql =" select * From user_info where user_id =' "& txtuserid. text & "'" set objrst = executesql (strsql) If objrst. the EOF then msgbox user name is incorrect! ", Vbokonly + vbcritical," warning "txtuserid. setfocus txtuserid. selstart = 0 txtuserid. sellength = Len (txtname. text) Exit sub else 'check if the password is correct if trim (objrst. fields (3) <> trim (txtpwd. text) Then msgbox "Incorrect password! ", Vbokonly + vbcritical," warning "txtuserid. setfocus txtuserid. selstart = 0 txtuserid. sellength = Len (txtpw. text) Exit sub else unload me 'unmount the logon form frmmain. show end if end ifend sub, of course, this is only the simplest logon interface. You can also add character restrictions. For example, you can only enter numbers and English characters as follows:
Public Function Check(ByVal Str2 As String) As Boolean Dim i As Integer Check = False For i = 0 To Len(Str2) - 1 str1 = Mid(Str2, i + 1, 1) If (Asc(str1) >= 45 And Asc(str1) <= 57) Or (Asc(str1) >= 65 And Asc(str1) <= 90) Or (Asc(str1) >= 97 And Asc(str1) <= 122) Or (Asc(str1) = 8) Or (Asc(str1) = 13) Then Check = False Else Check = True Exit Function End If Next iEnd Function
Accumulating slowly is king