没看懂你什么意思。
If e.DataCol.name = "班级数" Then
Dim idx as string = DataTables("表B").compute("count(班号)", "班号 Like '" & e.DataRow("年级") & "-" & "%'")
For i As Integer = idx To e.DataRow("班级数")
Dim str As String = e.DataRow("年级") & "-" & i & "班"
'Dim fdr As DataRow = DataTables("表B").find("班号 = '" & str & "'")
'If fdr IsNot Nothing Then
Dim nr As DataRow = DataTables("表B").AddNew
nr("班号") = str