Dim s As New List (Of String) For Each dt As DataTable In DataTables If dt.DataCols.Contains("身份证号码") Then For Each dr As DataRow In dt.DataRows s.Add(dr("身份证号码")) Next End If Next
Dim str As String Dim i,j As Integer For i = 0 To s.Count - 1 For j = 0 To i - 1 If s(i) = s(j) Then Exit For End If Next If i <> j Then str = str & s(i) & "|" End If Next str = str.TrimEnd("|") MessageBox.Show(str)