• Miércoles 15 de Mayo de 2024, 04:43

Autor Tema:  Otra Vez El Mshflexgrid  (Leído 7133 veces)

desarrollo

  • Miembro activo
  • **
  • Mensajes: 74
    • Ver Perfil
Otra Vez El Mshflexgrid
« en: Jueves 30 de Diciembre de 2004, 20:51 »
0
Sigo con los problemas ya no se k hacer


Private Sub Command2_Click()
Item = Item + 1

MSHFlexGrid1.Rows = MSHFlexGrid1.Rows + 1
MSHFlexGrid1.Row = MSHFlexGrid1.Rows - 1

MSHFlexGrid1.TextMatrix(0, 0) = "ITEM"
MSHFlexGrid1.ColWidth(0) = 1000
MSHFlexGrid1.TextMatrix(0, 1) = "CODIGO DE CONTROL DE CALIDAD"
MSHFlexGrid1.ColWidth(1) = 4000
MSHFlexGrid1.FixedRows = 1

MSHFlexGrid1.Col = 0
MSHFlexGrid1.Row = 1
MSHFlexGrid1.Text = Str(Item)

MSHFlexGrid1.Col = 1
MSHFlexGrid1.Row = i
MSHFlexGrid1.Text = DataCombo3.Text

al hacer esto me sale de la siguiente manera en el grid


ITEM     CODIGO DE CONTROL DE CALIDAD
  1        OPERATIVO

' EL PRIMERO ME SALE OK PERO CUANDO AGREGO EL OTRO CHANCA AL PRIMERO

OTRA INQUIETUD PARA BORRAR  UTILIZO ESTO
If MSHFlexGrid1.Rows > 1 Then
With MSHFlexGrid1
If .Row < .Rows - 1 Then
    For f = Row + 1 To Rows - 1
    For c = 0 To 3
    .TextMatrix(f - 1, c) = .TextMatrix(f, c)
    Next c
    Next f
    End If
    .Rows = Rows - 1
    End With
    i = i - 1
    End If

Pero no pasa nada AUXILIOOOOOOO por favor

Sagutxo

  • Miembro MUY activo
  • ***
  • Mensajes: 320
    • Ver Perfil
Re: Otra Vez El Mshflexgrid
« Respuesta #1 en: Jueves 30 de Diciembre de 2004, 21:54 »
0
Salu2.
Vuelves a asignar un valor a MSHFlexGrid1.Row

Código: Text
  1. MSHFlexGrid1.Row = 1
  2. MSHFlexGrid1.Text = Str(Item)
  3.  
  4. MSHFlexGrid1.Col = 1
  5. MSHFlexGrid1.Row = i
  6.  

No tienes que hacerlo, lo tienes hecho arriba

Código: Text
  1. MSHFlexGrid1.Rows = MSHFlexGrid1.Rows + 1
  2. MSHFlexGrid1.Row = MSHFlexGrid1.Rows - 1
  3.  
-----------------------------------------------------------

Para borrar toda la tabla MSHFlexGrid1.Clear
Agur. :comp:
Mi mujer tiene un físico bárbaro!!!. Einstein.

desarrollo

  • Miembro activo
  • **
  • Mensajes: 74
    • Ver Perfil
Re: Otra Vez El Mshflexgrid
« Respuesta #2 en: Jueves 30 de Diciembre de 2004, 22:25 »
0
Bueno ya sale y ya borra pero aun tengo inconvenientes

Private Sub Command2_Click()
Command3.Enabled = True
item = item + 1
MSHFlexGrid1.Rows = MSHFlexGrid1.Rows + 1
MSHFlexGrid1.Row = MSHFlexGrid1.Rows - 1

MSHFlexGrid1.TextMatrix(0, 0) = "ITEM"
MSHFlexGrid1.ColWidth(0) = 1000
MSHFlexGrid1.TextMatrix(0, 1) = "CODIGO DE CONTROL DE CALIDAD"
MSHFlexGrid1.ColWidth(1) = 4000
MSHFlexGrid1.FixedRows = 1

MSHFlexGrid1.Col = 0
MSHFlexGrid1.Row = item
MSHFlexGrid1.Text = Str(item)

MSHFlexGrid1.Col = 1
MSHFlexGrid1.Row = item
MSHFlexGrid1.Text = DataCombo3.Text

End Sub
**El inconveniente del agregar es que me agrega al final una linea en blanco lo demas todo ok

Private Sub Command3_Click()
If MSHFlexGrid1.Row = 0 Then
Command3.Enabled = False
MSHFlexGrid1.Rows = MSHFlexGrid1.Rows + 1
MSHFlexGrid1.Row = MSHFlexGrid1.Rows - 1
MSHFlexGrid1.FixedRows = 1

ElseIf MSHFlexGrid1.Rows >= 1 Then
With MSHFlexGrid1
If .Row < .Rows - 1 Then
    For f = Row + 1 To Rows - 1
    For c = 0 To 2
    .TextMatrix(f - 1, c) = .TextMatrix(f, c)
    Next c
    Next f
    End If
    .Rows = .Rows - 1
    End With
    item = item - 1
End If
End Sub

**** El inconveniente del eliminar es k cuando solo queda un registro para elimar todavia sigue el boton activado lo intente deshabilitar pero aun tengo problemas


Si tienen aluna sugerencia para k funcione bien se los agredecere mucho


Desarrollo  :comp:

Sagutxo

  • Miembro MUY activo
  • ***
  • Mensajes: 320
    • Ver Perfil
Re: Otra Vez El Mshflexgrid
« Respuesta #3 en: Jueves 30 de Diciembre de 2004, 23:09 »
0
Salu2.
1º.- has de quitar lineas que te sobran :
Código: Text
  1. MSHFlexGrid1.Col = 0
  2. 'MSHFlexGrid1.Row = item esta linea sobra ya la tienes asignada arriba.
  3. MSHFlexGrid1.Text = Str(item)
  4.  
  5. MSHFlexGrid1.Col = 1
  6. 'MSHFlexGrid1.Row = item ESTA TAMBIEN SOBRA
  7. MSHFlexGrid1.Text = DataCombo3.Text
  8.  
2º.- para borrar solo pon MSHFlexGrid1.Cleary te borra todo el MsFlesxGrid de una vez.

Espero que te sirva.
agur.
Mi mujer tiene un físico bárbaro!!!. Einstein.

Sagutxo

  • Miembro MUY activo
  • ***
  • Mensajes: 320
    • Ver Perfil
Re: Otra Vez El Mshflexgrid
« Respuesta #4 en: Jueves 30 de Diciembre de 2004, 23:18 »
0
Te voy a dejar un form, en el que uso un msflexgrid. uso un campo textBox para simular la edicion del msflexgrid, pero se podria usar un comboBox =mente o similar., te va a costar entenderlo, pero si lo miras bien lo acabarás comprendiendo. :). Suerte.

Agur.
El mensaje contiene 1 archivo adjunto. Debes ingresar o registrarte para poder verlo y descargarlo.
Mi mujer tiene un físico bárbaro!!!. Einstein.

desarrollo

  • Miembro activo
  • **
  • Mensajes: 74
    • Ver Perfil
Re: Otra Vez El Mshflexgrid
« Respuesta #5 en: Viernes 31 de Diciembre de 2004, 00:09 »
0
probe kitandole las lineas k me indicaste si hago eso ya no avanza se keda ahi y chanca lo primero

muchas gracias de todoas maneras  :hola:

fap1603

  • Miembro MUY activo
  • ***
  • Mensajes: 135
    • Ver Perfil
Re: Otra Vez El Mshflexgrid
« Respuesta #6 en: Viernes 31 de Diciembre de 2004, 05:10 »
0
Hola, para desactivar el boton que deseas puedes hacer una comparacion simple, de si esta vacio o no, y segun eso, lo inhabilitas, ahora para hacer la comprobacion, debes crear una pequeña funcion, a la cual llamas cada vez que la necesites, por ejemplo, mshflexgrid_lostfocus, o la que te interese, cuando pierde el enfoque, cuando haces click, etc.

Ahora, lo de que te agrege una linea al final, eso es por que el mshflexgrid, asigna un valor 0 a la primera fila y primera columna, como si fuera el excel, entonces cuando tu intentas trabajarla, la forma de contar cambia, y el cero se vueleve uno, por ejemplo, si le dices que tenga 2 filas, una es el titulo, y la otra donde pones el dato, pero a la hora de asignar el valor la supuesta fila 1 es = a cero, y la fila 2 es = a uno, eso es algo que debes controlar, es decir debes diferenciar entre dimensionar y asignar un valor, lo que yo hago es al terminar el proceso ,e quito la fila. Mira, yo utilizo mucho el mshflexgrid, si te apetece, escribeme a fap1603@hotmail.com, o agregame y te doy una mano en todo lo que pueda.
Saludos,

Francisco Ayala Pinazo
Lima - Perú

Sagutxo

  • Miembro MUY activo
  • ***
  • Mensajes: 320
    • Ver Perfil
Re: Otra Vez El Mshflexgrid
« Respuesta #7 en: Viernes 31 de Diciembre de 2004, 11:43 »
0
Salu2. akí te dejo tu codigo como pienso que debería estar.

Private Sub Command2_Click()
Command3.Enabled = True
item = item + 1
MSHFlexGrid1.Rows = MSHFlexGrid1.Rows + 1
MSHFlexGrid1.Row = MSHFlexGrid1.Rows - 1

' ESTAS LINEAS SOLO LAS PONDRIA CADA VEZ QUE REINICIE EL MSFLEXGRID
MSHFlexGrid1.TextMatrix(0, 0) = "ITEM"
MSHFlexGrid1.ColWidth(0) = 1000
MSHFlexGrid1.TextMatrix(0, 1) = "CODIGO DE CONTROL DE CALIDAD"
MSHFlexGrid1.ColWidth(1) = 4000
'------------------------------------------------------
' la linea de abajo la configuraría en las propiedades del msflexgrid pero eso a tu gusto
MSHFlexGrid1.FixedRows = 1
'-------------------------------------------------------

'MSHFlexGrid1.Col = 0 ESTO SOBRA
'MSHFlexGrid1.Row = item ESTO SOBRA
MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row,0) = Str(item)

'MSHFlexGrid1.Col = 1 ESTO SOBRA
'MSHFlexGrid1.Row = item ESTO SOBRA
MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row,1) = DataCombo3.Text

End Sub

Espero haberme explicado, ayer estaba cansado y me costaba pensar :).
Mi mujer tiene un físico bárbaro!!!. Einstein.

desarrollo

  • Miembro activo
  • **
  • Mensajes: 74
    • Ver Perfil
Re: Otra Vez El Mshflexgrid
« Respuesta #8 en: Viernes 31 de Diciembre de 2004, 15:50 »
0
Gracias Chicos ha sido de mucha utilidad para mi sus consejos gracias que tengan un Excelente Año Nuevo  Diviertanse!!!!!  :rolleyes:

wilderpaucar

  • Nuevo Miembro
  • *
  • Mensajes: 1
    • Ver Perfil
problema El Mshflexgrid al momento de usar additem y removei
« Respuesta #9 en: Jueves 24 de Septiembre de 2009, 05:55 »
0
soy usuario nuevo en este blog, el problema es cuando se añade filas a un mshflexgrid y luego se elimina alguna(s) fila con el mshflexgrid1.removeitem. Bueno la primera ves que se usa funciona bien pero si uno sigue borrando y añadiendo, las filas ya no se muestran o sea no se ven pero existen. Este problema es un dolor de cabeza para los que han chocado con ello.
He creado un código que borre las filas sin usar el romoveitem y asi no tener probleas al añadir nuevas filas. Ahi los dejo, espero que les sirva.

con este código eliminas 1 o varias filas que selecciones del mshflexgrid

 
 
Private Sub Command1_Click()
Call Eliminar_Flex(Me.MSHFlexGrid1)
End Sub

Sub Eliminar_Flex(FlexEliminar As MSHFlexGrid)
Dim i, J, NunfIL, FilasBorradas As Integer
On Error Resume Next
NunfIL = 0
With FlexEliminar
If .Row <= .RowSel Then
                For i = .Row To .Rows - 2
                NunfIL = NunfIL + 1
                For J = 0 To .Cols - 1
               Select Case .RowSel + NunfIL
                Case Is <= .Rows - 1
                .TextMatrix(i, J) = .TextMatrix(.RowSel + NunfIL, J)
                .TextMatrix(.RowSel + NunfIL, J) = ""
                Case Is > .Rows - 1
                .TextMatrix(i, J) = .TextMatrix(.Rows - 1, J)
                End Select
                Next
                Next
 Else
                For i = .RowSel To .Rows - 2
                NunfIL = NunfIL + 1
                For J = 0 To .Cols - 1
               Select Case .Row + NunfIL
                Case Is <= .Rows - 1
                .TextMatrix(i, J) = .TextMatrix(.Row + NunfIL, J)
                .TextMatrix(.Row + NunfIL, J) = ""
                Case Is > .Rows - 1
                .TextMatrix(i, J) = .TextMatrix(.Rows - 1, J)
                End Select
                Next
                Next
End If
FilasBorradas = Abs(.RowSel - .Row) + 1
.Rows = .Rows - FilasBorradas
End With
End Sub
 
 
 
Ahoroa si sólo quieres eliminar los datos y no modificar el número de filas, corriendo los demas datos que no hayas seleccionado a las filas en blanco que borraste, solo borra esto del codigo anterior:

FilasBorradas = Abs(.RowSel - .Row) + 1
.Rows = .Rows - FilasBorradas