Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

There's a checkbox column in DataGridView. Also, there's a text box which is used for searching.

When I type in textbox for search, results are filtered automatically. I choose the items I want from the filtered results. When I type another word/letters or delete the keyword from the textbox, the items which I have checked previously are gone.

Thanks in advance.

VB
'I Call This Process on Form Load
Public Sub GetSubAuditProcess()
        rdr.Close()
        If Connection.State = ConnectionState.Closed Then
            Connection.Open()
        End If
        cmdString = "SELECT * FROM B14_ALT_SUREC WHERE Alt_Surec IS NOT NULL GROUP BY MANDT, ID, Alt_Surec ORDER BY ID"
        DataAdp = New SqlDataAdapter(cmdString, Connection)
        DataAdp.Fill(dset)

        Connection.Close()
        dv.Table = dset.Tables(0)
        dgSubProcess.Rows.Clear()
        dgSubProcess.DataSource = dv

        If Connection.State = ConnectionState.Open Then
            Connection.Close()
        End If
    End Sub

'This is TextBox TextChange Event
    Private Sub txtSubProcess_TextChanged(sender As Object, e As EventArgs) Handles txtSubProcess.TextChanged
        dt.AcceptChanges()
        dv.RowFilter = "Alt_Surec LIKE '%" + txtSubProcess.Text + "%'"
    End Sub


What I have tried:

I tried the method of searching in all cells and lines in DataGridView.
Posted
Comments
bellatriks 3-Jun-16 8:48am    
Nobody has an idea??

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900