Results 1 to 4 of 4

Thread: [RESOLVED] Help with my ListView

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2005
    Posts
    310

    Resolved [RESOLVED] Help with my ListView

    Hi, need help, how can i code to get the total of that numbers in my lisview, see image below mark with red. I want to display the sum in text box.



    Thanks in advance!

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2005
    Posts
    310

    Re: Help with my ListView

    Hi, I manage to work this by this codes

    VB Code Code:
    1. Sub GetSumTotal()
    2.   Dim sum As Double
    3.   Dim x As Integer
    4.      sum = 0
    5.  For x = 1 To lvFilter.ListItems.count
    6.      sum = sum + lvFilter.ListItems.Item(x).SubItems(16)
    7.  Next
    8.     Text1.Text = sum
    9. End Sub

    My problem now is when the one of the Row in that Column is become "NULL" no value or records it show an error "Type MisMatch" and will no continue to calculate the next records..

  3. #3
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Help with my ListView

    Try replacing this line
    sum = sum + lvFilter.ListItems.Item(x).SubItems(16)
    with this
    sum = sum + Val(lvFilter.ListItems.Item(x).SubItems(16))
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2005
    Posts
    310

    Re: [RESOLVED] Help with my ListView

    thanks for that reply sir Lavolpe
    my codes work now with no errors. Resolved now.

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