Dim months As New List(Of String) For Each dt As DataTable In DataTables If dt.Name.Contains("明细") Then If dt.DataCols.Contains("月份") Then For Each month As String In dt.GetUniqueValues("", "月份") If months.Contains(month) = False Then months.Add(month) If months.Count >= 12 Then Exit For End If Next If months.Count >= 12 Then Exit For End If End If Next
Dim strMonth As String = "" For Each month As String In months strMonth = strMonth & month & "|" Next strMonth.Trim("|")