Any system must be optimized before completion, first of all you have to ensure that the software you do not have normal logic problems, but also to improve the user experience, so that others use more comfortable with it. So optimization is a process of continuous improvement.
Let me share my optimization experience for you.
1. Login screen
First of all, your guarantee that your login interface can not randomly input, control character length, but also pay attention to special characters, to prevent others to enter special characters will be error cases. And the user's password input can not be seen by others, to ensure the security of user passwords.
The length of the character in the text of the control property has a MaxLength property, you can enter the password you want to control the size of it. And how to enter password security is another attribute PasswordChar, you fill in * on it, you enter the password is *.
Special characters can be controlled by controlling the input text control data type as follows:
Private Sub txtusername_keypress (keyascii as Integer)
Select case KeyAscii Case
8 case
ASC ("A") to ASC ("Z") C4/>case ASC ("0") to ASC ("9") Case ASC ("
a") to ASC ("Z") case was
< 0 case
Else
keyascii = 0
End sele CT
End Sub
The above code means that my user name can only enter uppercase and lowercase characters and numbers (Chinese characters can also be entered, but the Chinese character input is not error), so that you can control the character input type, as well as the problem of special characters.
2. Modify the Password interface
Change the password, in order to more humane, you want to prompt the user, the current user is which bar. There is, you change the password before you have to verify the current password, or others in the user is not in the time to modify the user password, the system has a security risk.
Tip The current user code is as follows:
Private Sub Form_Load ()
Dim TxtSQL As String
Dim Msgtext As String
Dim mrc as ADODB. Recordset
Dim name as String
me.top = 0
me.left = 0
text2.text = ""
TxtSQL = "SELECT * FROM User_info where user_id = ' "& Username &" ' "
Set MRC = ExecuteSQL (TxtSQL, msgtext)
name = Trim (MRC. Fields (0))
label3.caption = "Current user name is:" & name
End Sub
The user name is transferred from the database. Assigned to LABEL3, displayed on the control.
The code to verify the original password is as follows:
If Trim (text2.text) <> Trim (MRC. Fields (1) and then
MsgBox "The original password was not entered correctly. ", vbOKOnly + vbexclamation," warning "
text2.setfocus
text2.text =" "
Text1 (1). Enabled = False
Text1 (2). Enabled = False
Else
next sub
End If
These lines of code is to compare the password entered by the user with the original password, to determine whether the user entered the original password is correct, if wrong, you will not be able to enter a new password. The problem that you need to pay attention to is that you have to be aware of the name of your control and that there are many control names that do not correspond to the code that causes the program to run incorrectly.
3. Information Query interface
In debugging the information query interface, you will find that the size of the control table is very annoying problem, because some information may be longer, resulting in some of the text or numbers can not be displayed, in fact, is also a space adjustment problem. The code is as follows:
Myflexgrid. Colwidth (0) = 1000
This means that the first column of your table has a width of 1000, and you can adjust the table width based on the actual information.
4. Course add-on interface
When you add a course, you will be prompted to add the lessons repeatedly. The code is resolved as follows:
Private Sub Cmdadd_click ()
Dim i as Variant
If listallcourse. ListIndex <>-1 then
If listselectcourse. ListIndex = 0 Then
listselectcourse. AddItem Listallcourse. List (Listallcourse. ListIndex)
End If for
i = 0 to Listselectcourse. ListCount-1
If Listselectcourse. List (i) = Listallcourse. List (Listallcourse. ListIndex) then
Exit Sub
End If
Next
listselectcourse. AddItem Listallcourse. List (Listallcourse. ListIndex)
end If
End Sub
These lines of code are not added to the course when you have a course database that you have added. And nothing can be added smoothly.
5. Minor problems
Clean up the contents of each table when you have finished adding the information. Prevent others from opening again, see the data that you fill in before, also can let you fill data continuously more convenient. There are two ways to solve this.
The first is that the contents of all controls are emptied after you have completed the input instructions. For example text1.text= ""
The second is to unload the form while you are finished typing the data.
These are some of the problems I encountered in the optimization of the Student Information management system, and the solution I found. Hope to be helpful to everyone. The rest of the questions I will continue to share with you in the future.