Hi All,

I am trying to do a record search feature in my datagrid, but I can't find any reference for this. What I want to do is I can search any of the row that contain the text that type in TextBox1 by clink on Button1.
Anyone can help with this? I am using VB2008 and the datagrid is connect to access.
Thanks.

Or I should explain like this, I want to search the record in the datagridview which source from access, and the datagridview is not connected to TABLE in access, but VIEW. The code that I just get is only for table, below is the code:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim con As New OleDb.OleDbConnection
        Dim dsOle As New DataSet
        Dim da As New OleDb.OleDbDataAdapter
        Dim dtOle As New DataTable
        Dim cmdOle As New OleDb.OleDbCommand
        con.ConnectionString = ("Provider = Microsoft.ACE.OLEDB.12.0;Data Source= .\test.accdb")
        Try
            dsOle.Clear()
            dtOle.Clear()
            cmdOle = con.CreateCommand
            cmdOle.CommandText = "SELECT * FROM Table1 where SerialNo LIKE '%" & Trim(TextBox1.Text) & "%'"

            da.SelectCommand = cmdOle
            da.Fill(dsOle, "Table1") ' This Table name            
            Table1DataGridView.DataSource = dsOle
            Table1DataGridView.DataMember = "Table1" ' This Table name            
            Table1DataGridView.ReadOnly = True

        Catch ex As Exception
            MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Record Not Found")
        End Try

    End Sub

I cant get the full information that I want after search, there still have 2 columns with date and datediff in access cant show.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.