Jump to content

Recommended Posts

Posted

Oi Pessoal

Tenho uma rotina que me faz a busca de um valor pelas linhas em relação a uma dada coluna e me assinala a linha que contem o filtro.Funciona

Mostro a rotina:

Dim texto As String = Nothing

        If ToolStripTextBox1.Text <> String.Empty Then
            'percorre cada linha do DataGridView
            For Each linha As DataGridViewRow In PrincipalDataGridView.Rows
                'percorre cada célula da linha
                For Each celula As DataGridViewCell In PrincipalDataGridView.Rows(linha.Index).Cells
                    'se a coluna for a coluna 1 (Nome) então verifica o criterio
                    If celula.ColumnIndex = 2 Then
                        texto = celula.Value.ToString.ToLower
                        'se o texto informado estiver contido na célula então seleciona toda linha
                        If texto.Contains(ToolStripTextBox1.Text.ToLower) Then
                            'seleciona a linha
                            Me.PrincipalDataGridView.Rows(celula.RowIndex).Selected = True


                            Exit Sub
                        End If
                    End If
                Next
            Next
        End If

Como faço para que o ponteiro se mova para a linha seleccionada?

Desde jáObrigado pela atenção

Chamuanza

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.