Dim t As Table = Tables(e.Form.name & "_table2")
Dim Names As List(Of String) = t.DataTable.GetValues("单据编号",t.Filter)
Dim i As Integer = 0
For Each nm As String In names
Dim idx As Integer = t.Find(nm,0,"单据编号",True,True,False)
If idx > - 1 Then
msgbox("第一次" & idx+1)
For i = idx + 1 To t.Rows.Count - 1
If nm <> t.Rows(i)("单据编号") Then
msgbox("最后一次" & i)
Exit For
End If
Next
End If
Next