Karolina Sanovic
asked on
search by any word in column
I have code for search and everything works but I would like my last column named napomena(reminder) to make search by any word inside the column because I cant write all text from column.
search-by-word.png
Private Sub Buttonsearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttonsearch.Click
school = cmbSearch.Text
Select Case school
Case "datum"
Me.NapomenaBindingSource.Filter = "datum='" & txtSearch.Text & "'"
Case "pčelinjak"
Me.NapomenaBindingSource.Filter = "pčelinjak= '" & txtSearch.Text & "'"
Case "košnica br"
Me.NapomenaBindingSource.Filter = "[košnica br]='" & txtSearch.Text & "'"
Case "napomena"
Me.NapomenaBindingSource.Filter = "napomena= '" & txtSearch.Text & "'"
End Select
If NapomenaBindingSource.Count <> 0 Then
With NapomenaDataGridView
.DataSource = NapomenaBindingSource
End With
Else
Me.notFound()
End If
End Sub
code-search-by-word.pngsearch-by-word.png
Not clear what exactly you are trying to achieve can you explain a bit further
try use the like clause, quick try:
Me.NapomenaBindingSource.Filter = "napomena like '%" & txtSearch.Text & "%'"
ASKER
I have column napomena(reminder) and I put in that column text with some informations and I want to search not needed to write whole informations.Example in my column I have written "John Smith is a boy 10.years" I want in my textbox for search to writte Smith and get searched and be found
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It works,thanks