Jump to content

pesquisar na datagridview


legd1991

Recommended Posts

Para isso tens q por o evento TextChanged da textbox a obter a palavra q introduziste.

Com essa palavra filtras os teus dados e afectas novamente o datasource da gridview (Aqui usar linq facilita mto a vida).

Isso deve ser o suficiente para o q queres.

Matraquilhos para Android.

Gratuito na Play Store.

https://play.google.com/store/apps/details?id=pt.bca.matraquilhos

Link to comment
Share on other sites

podes so explicar como faço essa parte do startswish??

eu tenho assim:

Dim texto As String = Nothing

        If TextBox1.Text <> String.Empty Then

            For Each linha As DataGridViewRow In EmpresasDataGridView.Rows
                For Each celula As DataGridViewCell In EmpresasDataGridView.Rows(linha.Index).Cells
                    If celula.ColumnIndex = 1 Then
                        texto = UCase(celula.Value.ToString)
                        'se o texto informado estiver contido na célula então seleciona toda linha
                        If texto = UCase(TextBox1.Text) Then
                            'seleciona a linha

                            EmpresasDataGridView.CurrentCell = celula

                            Exit Sub
                        End If

                    End If


                Next
            Next
        End If 
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.