Dim tb5 As Table = Tables("学生信息A_table5")
Dim bs As Integer = e.Form.Controls("combobox3").text
Dim j As Integer = 1
tb5.sort = "性别,学生姓名"
Dim lst As New List(Of Integer)
Dim lst2 As New List(Of Integer)
For i As Integer = 1 To bs
lst.Add(i)
Next
Dim ssr() As Integer = lst.ToArray
Dim k As Integer = 0
Dim cnt As Integer = tb5.Rows.count - 1
Dim r As Row
Do While k <= cnt
r = tb5.Rows(k)
k = k + 1
If r.IsNull("指定分班") Then
If lst.Count = 0 Then
lst.AddRange(ssr)
For n As Integer = lst2.Count - 1 To 0 Step - 1
If lst.Contains(lst2(n)) Then
lst.Remove(lst2(n))
lst2.RemoveAt(n)
End If
Next
End If
r("预分班") = lst(0)
lst.RemoveAt(0)
Else
Dim zd As Integer = r.IsNull("指定分班")
If lst.Contains(zd) Then
r("预分班") = zd
lst.Remove(zd)
Else
lst2.Add(zd)
End If
End If
Loop