Ver Mensaje Individual
  #1 (permalink)  
Antiguo 29/07/2011, 14:43
ikartz
 
Fecha de Ingreso: junio-2011
Ubicación: España
Mensajes: 32
Antigüedad: 12 años, 11 meses
Puntos: 0
Exclamación [Visual Basic] Seleccionar una línea del DataGridView

Intento seleccionar una línea del DataGridView así:
Código:
Dim lastRow As Integer = DGV.RowCount
        MsgBox(lastRow)
        DGV.Rows(lastRow).Selected = True
El messagebox me devuelve el valor correcto, pero cuando toca a seleccionar essa misma línea me devuelve un error:
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Pero si le asigno yo un valor, por ejemplo:
Código:
DGV.Rows(5).Selected = True
La selecciona sin cualquier problema.