Ver Mensaje Individual
  #5 (permalink)  
Antiguo 27/07/2011, 15:20
ikartz
 
Fecha de Ingreso: junio-2011
Ubicación: España
Mensajes: 32
Antigüedad: 12 años, 10 meses
Puntos: 0
Respuesta: DatagridView selecionar línea

gracias por la respuesta.. la verdad es que he intentado el método de binding antes pero tuve malas experiencias.

no hay manera de seleccionar solo la línea, no para alguna variable ni nada, solo seleccionarla como si fuera el usuario a poner el ratón encima y hacer 1 click.

Código:
Dim lastRow As Integer = DGV.RowCount - 1
        
        editar.Show()
        editar.txtID.Text = DGV.CurrentRow.Cells(0).Value.ToString

        editar.txtID.Text = DGV.Rows(lastRow).Cells(0).Value.ToString

        editar.txtCodigo.Text = DGV.Rows(lastRow).Cells(1).Value.ToString
        editar.txtDesc.Text = DGV.Rows(lastRow).Cells(2).Value.ToString
        editar.txtData.Text = DGV.Rows(lastRow).Cells(3).Value.ToString
        editar.txtPercentagem.Text = DGV.Rows(lastRow).Cells(4).Value.ToString
        editar.txtMedia.Text = DGV.Rows(lastRow).Cells(5).Value.ToString
si hago como ahí me salta el error:
System.NullReferenceException - {"Object reference not set to an instance of an object."}


ya probé com:
Código:
DGV.Rows(lastRow).Selected = True
pero tampoco me fue >_>

perdon por estar insistiendo ^^'