I'm implementing a system and in that system, I want to search product while text changing on textbox in the datagridview. I've already done that part.
But I found out that search command only helping me to find the product 1st word of the cell. But I want to filter it with any of the selected cells.
Example:
In my datagridview there is a column Product Name
. In that column, there Is a data as Galaxy A20s. Currently, I have to type on my search textbox starting as Galaxy.... then only search result appearing. I want to modify the output like if I'm type A20s then also result should be filtered in the datagridview.
Any possibilities to do that in vb.net.
Here is the code which I'm using currently.
Try
con = New OleDbConnection(cs)
con.Open()
cmd = New OleDbCommand("SELECT (ProductID) as [Product ID],(ProductName) as [Product Name],(Brand) as [Brand],(UnitPrice) as [Unit Price] from ProductDB where ProductName like '" & txtSearch.Text & "%' order by ProductName", con)
Dim myDA As OleDbDataAdapter = New OleDbDataAdapter(cmd)
Dim myDataSet As DataSet = New DataSet()
myDA.Fill(myDataSet, "ProductDB")
dgFillProduct_Stock.DataSource = myDataSet.Tables("ProductDB").DefaultView
con.Close()
Catch ex As Exception
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
Thanks