Posted 18 March 2020, 2:52 pm EST
Hello,
I’m musing the code below to compare two grids based on records selected in C1Data and Fields in MultiSelect1 controls. How do I modify it to matching records in both C1Data and C1DataB in C1Screen3? The code below only shows the results for C1DataB in C1Screens.
Dim xyz1 As String = “”
If C1Data.SelectedRows.Count > 0 Then
If RadioButton5.Checked Then
For iCol = 0 To C1MultiSelect1.SelectedItems.Count - 1
For Each Srow In C1Data.SelectedRows
xyz1 = xyz1 + “[” + C1MultiSelect1.SelectedItems(iCol).Value + “] = '” + C1Data.Columns(C1MultiSelect1.SelectedItems(iCol).Value).CellText(Srow) + "’ OR "
Next
Next
xyz1 = xyz1.Remove(xyz1.Length - 4, 4)
Console.WriteLine(xyz1)
End If
If RadioButton6.Checked Then For Each Srow In C1Data.SelectedRows For iCol = 0 To C1MultiSelect1.SelectedItems.Count - 1 xyz1 = xyz1 + "[" + C1MultiSelect1.SelectedItems(iCol).Value + "] = '" + C1Data.Columns(C1MultiSelect1.SelectedItems(iCol).Value).CellText(Srow) + "' AND " Next xyz1 = xyz1.Remove(xyz1.Length - 4, 4) xyz1 = xyz1 + "OR " Next xyz1 = xyz1.Remove(xyz1.Length - 4, 4) Console.WriteLine(xyz1) End If End If Dim FilteredDTA1 As DataTable FilteredDTA1 = C1DataB.DataSource Dim view51 As DataView view51 = New DataView(FilteredDTA1) view51.RowFilter = xyz1 C1Screen3.DataSource = view51
Thanks,
Victor