Ver Mensaje Individual
  #7 (permalink)  
Antiguo 27/01/2007, 21:07
luciano
 
Fecha de Ingreso: abril-2004
Mensajes: 192
Antigüedad: 20 años, 1 mes
Puntos: 0
Re: Calcular campos de un Listview a un textbox

Algo estás haciendo mal, porque a mi me va perfecto.

Yo lo hice con este ejemplo, que es igual al que tenes

coloca un ListView1 y un command1

Código:
Private Sub Command1_Click()
MsgBox sumarGastos
End Sub

Private Sub Form_Load()
    
    Dim Item As ListItem
    
    With ListView1
    
        .ColumnHeaders.Add , , "Item"
        .ColumnHeaders.Add , , "SubItem"
        .View = lvwReport
        
        Set Item = .ListItems.Add(, , "Elemento 1")
            
            Item.SubItems(1) = "3,6"
        Set Item = .ListItems.Add(, , "Elemento 2")
            Item.SubItems(1) = "2,2"
    End With
    
        
    
End Sub
Private Function sumarGastos() As Variant
    
    Dim i As Integer
    
    For i = 1 To ListView1.ListItems.Count
        sumarGastos = Round(sumarGastos + CDbl(ListView1.ListItems(i).SubItems(1)), 2)
    Next i

End Function
__________________
Recursos visual basic