Dim Names As New List(Of String)
For Each r As Row In Tables(e.Form.name & "_table2").Rows
If Names.Contains(r("单据编号"))= False Then
Names.Add(r("单据编号"))
End If
Next
Dim i As Integer = 0
For Each nm As String In names
For Each r As Row In Tables(e.Form.name & "_table2").Rows
If nm = r("单据编号") Then
msgbox("第一次" & r.Index)
i=i+1
End If
Next
MessageBox.Show("最后一次" & r.index)
Next