There are many errors in the student information management system that need to be solved. Next I will solve an error in the "Grade Course settings" form in the student information management system, "adding data repeatedly in the list ", when you set a course for a grade, you can add a course several times! Below I will demonstrate how to solve the problem of "adding data repeatedly in list" Code ! Private sub register add_click ()
Dim I as integer defines two Integer Variables
Dim J as integer 'Add a course to the listselectcourse list If listallcourse. listindex <>-1 then
Listselectcourse. additem listallcourse. List (listallcourse. listindex)
End if
For I = 0 to listselectcourse. listcount-1 'External Loop
For J = I + 1 to listselectcourse. listcount 'inner looping 'to determine whether the same data exists in the list
If listselectcourse. List (I) = listselectcourse. List (j) Then listselectcourse. removeitem j 'deletes the added data msgbox. "You have added a course. Please delete it before adding it! "Exit sub end if next J next I end sub
In this way, the same data will not be added again in the List table.