SoloCodigo
CLR: .Net / Mono / Boo / Otros CLR => C# => Mensaje iniciado por: LUIS_PROGRAC# en Miércoles 28 de Febrero de 2007, 19:09
-
eliminar filas en blanco de un data grid necesito utilizar estas funciones hecahs en en visual bsic pasarlas a c# pero en vez del flexgrid quiero el data grid
Public Function filaVacia(grilla As String, fila As Long) As Boolean
On Error GoTo errorHandle
filaVacia = False
Select Case grilla 'Verifica si existen filas vacías
Case "det"
If Me.fgDetalle.TextMatrix(fila, 1) = "" And _
Me.fgDetalle.TextMatrix(fila, 2) = "" And _
Me.fgDetalle.TextMatrix(fila, 3) = "" And _
Me.fgDetalle.TextMatrix(fila, 4) = "" And _
Me.fgDetalle.TextMatrix(fila, 5) = "" And _
Me.fgDetalle.TextMatrix(fila, 6) = "" And _
Me.fgDetalle.TextMatrix(fila, 8) = "" Then
filaVacia = True
Exit Function
End If
Case "def"
With Me.fgDefectos
If .TextMatrix(fila, 2) = "" And _
.TextMatrix(fila, 5) = "" Then
filaVacia = True
Exit Function
End If
End With
End Select
Exit Function
errorHandle:
MsgBox "filaVacia - " & Err.Description, vbCritical, Me.Caption
filaVacia = False
End Function
Public Function limpiarFilasVacias()
On Error GoTo errorHandle
Dim i As Long 'Remueve todas la filas vacías previo a un insert
For i = 1 To Me.fgDetalle.rows - 1
If filaVacia("det", i) = True Then
Me.fgDetalle.row = i
delReg Me.fgDetalle
End If
Next
For i = 1 To Me.fgDefectos.rows - 1
If filaVacia("def", i) = True Then
Me.fgDefectos.row = i
delReg Me.fgDefectos
End If
Next
Exit Function
errorHandle:
MsgBox "limpiarFilasVacias - " & Err.Description, vbCritical, Me.Caption
End Function
Public Function delReg(grilla As MSFlexGrid)
If grilla.rows > 1 And grilla.RowSel <> (grilla.rows) Then
If grilla.row = 1 And grilla.rows = 2 Then
grilla.rows = 1
Else
grilla.RemoveItem grilla.RowSel
End If
End If
End Function
-
y cual es el problema?
-
ese es el código con flex grid?
Mi idea sería no eliminar las filas en blanco, sino, no dejar que hayan filas en blanco en el DataGRid.
Lo q podemos es hacer es que empiezes el código en Csharp por partes y te vamos a ayudando.
Saludos,
-
osea quiro que se eliminen las filas en blanco antes de guardar