• Jueves 28 de Marzo de 2024, 13:02

Autor Tema:  Eliminar  (Leído 995 veces)

LUIS_PROGRAC#

  • Nuevo Miembro
  • *
  • Mensajes: 8
    • Ver Perfil
Eliminar
« en: Miércoles 28 de Febrero de 2007, 19:09 »
0
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

JuanK

  • Miembro de ORO
  • ******
  • Mensajes: 5393
  • Nacionalidad: co
    • Ver Perfil
    • http://juank.io
Re: Eliminar
« Respuesta #1 en: Miércoles 28 de Febrero de 2007, 19:44 »
0
y cual es el problema?
[size=109]Juan Carlos Ruiz Pacheco
[/size]
Microsoft Technical Evangelist
@JuanKRuiz
http://juank.io

sergiotarrillo

  • Moderador
  • ******
  • Mensajes: 1059
    • Ver Perfil
    • http://sergiot2.com/blog
Re: Eliminar
« Respuesta #2 en: Jueves 1 de Marzo de 2007, 05:57 »
0
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,


Sergio Tarrillo
Blog]miBlog[/url]

No me visiten!

LUIS_PROGRAC#

  • Nuevo Miembro
  • *
  • Mensajes: 8
    • Ver Perfil
Re: Eliminar
« Respuesta #3 en: Lunes 12 de Marzo de 2007, 20:33 »
0
osea quiro que se eliminen las filas en blanco antes de guardar