Dim cbx As WinForm.ComboBox = e.Form.Controls("ComboBox1") Dim i As Integer = 1 Dim direct As Boolean = False For Each dr As DataRow In DataTables("学生成绩库").Select("", "总分 desc") dr("组别") = i If direct = False Then If i = cbx.text Then direct = True Else i += 1 End If Else If i = 1 Then direct = False Else i -= 1 End If End If Next