Ver Mensaje Individual
  #2 (permalink)  
Antiguo 21/09/2010, 08:37
winexim
 
Fecha de Ingreso: marzo-2007
Mensajes: 74
Antigüedad: 17 años, 1 mes
Puntos: 0
Respuesta: como poner foco a un renglon de un datagridview

En DGVMateriales pones el nombre de tu datagridview
En Cells(0) pones el numero de la columna a buscar comienzan de 0
CmdBuscaMaterial es el boton que realiza la busqueda
TxtClave.Text es el texto que insertan para buscar

Saludos espero que te sirva



Private Sub CmdBuscaMaterial_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdBuscaMaterial.Click
Dim I As Integer
Dim Found As Boolean
If Trim(TxtClave.Text) = "" Then
TxtClave.Focus()
Else
Found = False
For I = 0 To DGVMateriales.RowCount - 1
If DGVMateriales.Rows(I).Cells(0).Value.ToString = TxtClave.Text Then
Me.DGVMateriales.Rows(I).Selected = True
Me.DGVMateriales.FirstDisplayedScrollingRowIndex = I
Found = True
Exit For
End If

Next I
If Not Found Then
MsgBox("No existe ese numero")
TxtClave.Focus()
End If
End If
End Sub