Posted 7 March 2020, 3:29 am EST
Hello Prabhat,
I noticed the code below you sent me does not include C1TrueDBGRid6, which I think would be needed to be compared with C1TrueDBGrid1.
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim xyz As String = “”
If C1TrueDBGrid1.SelectedRows.Count > 0 Then
For iCol = 0 To C1MultiSelect1.SelectedItems.Count - 1
For Each Srow In C1TrueDBGrid1.SelectedRows
Console.WriteLine(C1TrueDBGrid1.SelectedRows.Count)
xyz = xyz + “[” + C1MultiSelect1.SelectedItems(iCol).Value + “] = '” + C1TrueDBGrid1.Columns(C1MultiSelect1.SelectedItems(iCol).Value).CellText(Srow) + "’ OR "
Next
’ Uncomment the code to Display matching data in all selected fields
'xyz = xyz.Remove(xyz.Length - 4, 4)
'xyz = xyz + "AND "
Next
xyz = xyz.Remove(xyz.Length - 4, 4)
Console.WriteLine(xyz)
End If
fsLinkCHPT = New System.IO.FileStream(Application.StartupPath + “\AOP5A.xml”, IO.FileMode.Open)
dtsetLinkCHPT.Clear()
dtsetLinkCHPT.ReadXml(fsLinkCHPT)
fsLinkCHPT.Close()
Dim FilteredDTA As DataTable
FilteredDTA = dtsetLinkCHPT.Tables(0)
Dim view5 As DataView
view5 = New DataView(FilteredDTA)
view5.RowFilter = xyz
C1TrueDBGrid5.DataSource = view5
C1TrueDBGrid1.SelectedRows.Clear()
End Sub
My goal is for example.
Select Country and AGD from the Multiselect control
Select two records in Grid1 where
Country AGD
USA M55
BEL M59
System compares values selected in Grid6
if Grid6 contains:
Country AGD
USA M55
BEL M59
Grid1 Displays:
Country AGD
USA M55
BEL M59
USA M55
BEL M59
Which will than be sorted for selected fields.
Please note if using the “OR” approach
Grid5 would display additional records where either values in COUNTRY and AGD is included in Grid6.
Thanks,
Victor