Hello
I have a problem that i cannot solve with duplications in results in DataGridView.
So here is picture how it looks like in result
https://ibb.co/tHvt8KQ
I want to remove the duplicates not to be showed in result, but it didn't work it still displays the duplicates (same numbers) when reads from File1 - Production modules.xlsx file
Dim file1 As String = System.AppDomain.CurrentDomain.BaseDirectory & "\Production modules.xlsx"
Dim file2 As String = System.AppDomain.CurrentDomain.BaseDirectory & "\ConnectorListMST.xlsx"
Using dt1 As DataTable = ReadExcelToDataTable(file1)
Using dt2 As DataTable = ReadExcelToDataTable(file2)
Dim partNos = (From data In dt2.AsEnumerable()
Select data("Part No")).Distinct().ToArray()
Dim partNos2 = (From data In dt1.AsEnumerable()
Where data("Note").ToString().ToLower().Contains("connector") Or data("Note").ToString().ToLower().Contains("Connector")
Select data("Yazaki name")).Distinct().ToArray()
Dim dt As DataTable = New DataTable()
dt.Columns.Add("Partnumber")
dt.Columns.Add("Status")
For Each dr As DataRow In dt1.Rows
If Not String.IsNullOrEmpty(dr("Yazaki name").ToString()) Then
If Array.IndexOf(partNos, partNos2) >= 0 Then
dt.Rows.Add(dr("Yazaki name").ToString(), "Exists")
Else
dt.Rows.Add(dr("Yazaki name").ToString(), "missing number")
End If
End If
Next
dataGridView1.DataSource = dt
End Using
End Using