Search code examples
vb.netsearchdevexpressgridcontroltextedit

Search in TextEdit Control Devexpress vb.net


There are two controls in my form GridControl and TextEdit Control. I have bulk data of Product names. I need to write 15 to 20 product names in single TextEdit control separating them by spaces. When I type in TextEdit first product name It can find correctly first product name​ in GridControl by GridView1.ApplyFindFilter("SomeProductName"). But when I type second Product name it includes previous Product Name in query but I need the previous product name automatically remove from query by pressing space key but not from TextEdit.


Solution

  • You could use something like this to search only on the last term:

    Public Sub ApplyFindFilterToLastTerm(terms As String)
        Dim lastTerm = terms.Split(" "c).Last
        ApplyFindFilter(lastTerm)
    End Sub
    

    And call that each time the user enters a space by handling the KeyDown event