Chamuanza Posted April 14, 2009 at 09:01 PM Report #256778 Posted April 14, 2009 at 09:01 PM 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
José Lopes Posted April 14, 2009 at 09:55 PM Report #256792 Posted April 14, 2009 at 09:55 PM mas ele já nao está a fazer isso? Quando te pedirem peixe.... ensina-os a Pescar!!Hum..lálálálá!!
Chamuanza Posted April 14, 2009 at 09:59 PM Author Report #256793 Posted April 14, 2009 at 09:59 PM a linha de facto fica selecionada, mas o ponteiro não se move O que pretendo é que a linha selecionada seja a linha currente
jpaulino Posted April 14, 2009 at 11:07 PM Report #256810 Posted April 14, 2009 at 11:07 PM Tens de fazer: Me.PrincipalDataGridView.CurrentCell = celula
Chamuanza Posted April 15, 2009 at 05:11 AM Author Report #256830 Posted April 15, 2009 at 05:11 AM Bingo - 😁 Obrigado pela atenção
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now