Help with partial string search in selecetd rows

Posted by: victor_charles on 26 June 2020, 5:00 pm EST

    • Post Options:
    • Link

    Posted 26 June 2020, 5:00 pm EST

    Hi,

    How do I modify the code below to also include partial string search, for example if data selected in C1Data includes XM66A1 and data in C1TrueDBGrid9 includes M66, I would also like to display record containing M66 in C1Screen1.

                 Dim xyz As String = ""
                If C1Data.SelectedRows.Count > 0 Then
                    ' Selected Field(s)
                    If RadioButton3.Checked Then
                        For iCol = 0 To C1MultiSelect3.SelectedItems.Count - 1
                            For Each Srow In C1Data.SelectedRows
                                xyz = xyz + "[" + C1MultiSelect3.SelectedItems(iCol).Value + "] = '" + C1Data.Columns(C1MultiSelect3.SelectedItems(iCol).Value).CellText(Srow) + "' OR "
                            Next
                        Next
                        xyz = xyz.Remove(xyz.Length - 4, 4)
                        Console.WriteLine(xyz)
                    End If
                    'All Field(s)
                    If RadioButton4.Checked Then
                        For Each Srow In C1Data.SelectedRows
                            For iCol = 0 To C1MultiSelect3.SelectedItems.Count - 1
                                xyz = xyz + "[" + C1MultiSelect3.SelectedItems(iCol).Value + "] = '" + C1Data.Columns(C1MultiSelect3.SelectedItems(iCol).Value).CellText(Srow) + "' AND "
                            Next
                            xyz = xyz.Remove(xyz.Length - 4, 4)
                            xyz = xyz + "OR "
                        Next
                        xyz = xyz.Remove(xyz.Length - 4, 4)
                        Console.WriteLine(xyz)
                    End If
                    FilteredDTA = C1TrueDBGrid9.DataSource
                    view5 = New DataView(FilteredDTA)
                    view5.RowFilter = xyz
                    C1Screen1.DataSource = view5
                End If
            End If
    

    Thanks,

    Victor

  • Posted 29 June 2020, 2:36 am EST

    Hi Victor,

    Sorry but your code has a number of unknowns like C1Data, XM66A1, and C1Screen1.

    In order to help you in a better way, we need a stripped down sample from your side replicating the issue.

    Regards,

    Prabhat Sharma.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels