Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/11/2011, 06:53
carnero
 
Fecha de Ingreso: noviembre-2009
Mensajes: 315
Antigüedad: 14 años, 5 meses
Puntos: 0
Pregunta revision codigo: sacar duplicado

HOLAS
CON LE SIGUIENTE CODIGO RECORRO LOS LISTBOX Y BUSCO DUPLICADOS Y SUMO CANTIDAD, PESO, VALOR.
EL ASUNTO ES QUE CON POCOS REGISTROS FUNCIONA, PERO CON MAS DE 100, NO.
PORFA SI ME PUEDEN AYUDAR
Código vb:
Ver original
  1. For i = 0 To (List1.ListCount) - 2
  2.         P = i
  3.        
  4. For Ñ = 0 To (List1.ListCount) - 2
  5.               If List1.List(i) <> List1.List(Ñ) And es = True Then   ' agrega datos y elimina p
  6.                List1.ListIndex = P
  7.                 List2.ListIndex = P
  8.                 List5.ListIndex = P
  9.                 List3.ListIndex = P
  10.                 List4.ListIndex = P
  11.                                                                                                              
  12.                 cod = List1.Text
  13.                 uni = uni + Round(List5.Text)
  14.                 peso = peso + Round(List3.Text)
  15.                 neto = neto + Round(List4.Text)
  16.                 des = List2.Text
  17.                                                                                                              
  18.                 List1.RemoveItem P
  19.                 List2.RemoveItem P
  20.                 List5.RemoveItem P
  21.                 List3.RemoveItem P
  22.                 List4.RemoveItem P
  23.                                                                                                              
  24.                 List1.AddItem cod
  25.                 List2.AddItem des
  26.                 List3.AddItem peso
  27.                 List4.AddItem neto
  28.                 List5.AddItem uni
  29.                 es = False
  30.         End If
  31.     If List1.List(i) = List1.List(Ñ) Then
  32.             List1.ListIndex = Ñ
  33.         If List1.ListIndex = i Then GoTo sig
  34.                 List2.ListIndex = Ñ
  35.                 List3.ListIndex = Ñ
  36.                 List5.ListIndex = Ñ
  37.                 List4.ListIndex = Ñ
  38.                 uni = uni + Int(List5.Text)
  39.                 peso = peso + Round(List3.Text)
  40.                 neto = neto + Round(List4.Text)
  41.                 List1.RemoveItem Ñ
  42.                 List2.RemoveItem Ñ
  43.                 List3.RemoveItem Ñ
  44.                 List5.RemoveItem Ñ
  45.                 List4.RemoveItem Ñ
  46.                     es = True
  47.     End If
  48.    
  49. sig:
  50. Next Ñ
  51. Next i

muuuuuuuuuuuuuuuuuuchas graciassss!!!

Última edición por carnero; 23/11/2011 a las 13:00