1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| Private Sub cherche(ByVal text As String)
Dim rw As DataGridViewRow = Nothing
'**** Boucle à la recherche de la cellule.
For Each rw In Dgv1.Rows
'*** adapter l'index de la cellule au besoin.
If Not rw.Cells(0).Value Is Nothing AndAlso rw.Cells(0).Value.ToString = text Then
'*** Pour sélectionner uniquement la cellule.
Dgv1.CurrentCell = rw.Cells(0)
End If
Next
'*** Pour avoir la sélection toujours visible.
Dgv1.FirstDisplayedCell = Dgv1.CurrentCell
End Sub
Private Sub tb1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles tb1.TextChanged
cherche(tb1.Text)
End Sub |
Partager