Ver Mensaje Individual
  #8 (permalink)  
Antiguo 06/05/2009, 16:57
vpbettancourt
 
Fecha de Ingreso: mayo-2009
Mensajes: 1
Antigüedad: 14 años, 11 meses
Puntos: 0
Respuesta: Limpiar DatagridView

Deberias probar con esto:

Private Sub btnLimpiar_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnLimpiar.Click
Try
If datagridview.RowCount >= 1 Then
For i As Integer = 0 To datagridview.RowCount - 2
datagridview.Rows.Remove(datagridview.CurrentRow)
Next
End If
Catch ex As InvalidOperationException' Esta excepcion es por si ocurriera
MsgBox("Esta fila no se puede eliminar", MsgBoxStyle.Critical, "Operación inválida : : : . . .")
End Try
End Sub