Results 1 to 2 of 2

Thread: Calculation Problem

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2001
    Posts
    759
    Hi Everyone,

    I currently have a ListView control with three columns in it (Subtract, Add, Total). Is what I need to do is this, for every item in the ListView I either need to subtract the amount from the Total or I need to add the amount to the Total. Any ideas on how to do this inside of the ListView control. I would appreicate any help. Thank you.

  2. #2
    Hyperactive Member
    Join Date
    Feb 2001
    Location
    LoCal
    Posts
    280
    Hey Ace,

    Give this a try... this assumes that you have a value in Total and then either a value in Add or a value in Substract.

    Code:
    Dim intIndex as Integer
    Dim intCount as Integer
    
    '// Assuming lvwListView is your listview control
    intCount = lvwListView.ListItems.Count
    
    For intIndex = 1 to intCount
      '// Assuming .Text = Total, .SubItems(1) = Add, .SubItems(2) = Substract
      With lvwListView.ListItems(intIndex)
           .Text = Cstr(Val(.Text) + Val(.SubItems(1)) - Val(.SubItems(2)))
       End With
    Next
    Achichincle

    VB6 (VSEE SP5, W2KPro)
    ASP
    HTML

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width