• Log in or sign up for an account here: https://www.sythe.org/login

sum numbers in a collection

exiled warrior

Forum Addict

Banned
Joined
Apr 4, 2006
Sythe Gold
0
Messages
585
i need to write a sub procedure that adds all the numbers in a collection. if it helps at all my program will know how many items are in the collection.

am i looking for a for/next loop an array or wat?

pls help
 
Two Factor Authentication User
If you are using VB 2008, you should just be able to do this:
Code:
Dim SumOfCollection = Collection.Sum()
If not, a for each loop like this would work:
Code:
Dim Sum as Integer = 0
For Each Value As Integer In Collection
    Sum += Value
Next
 
i dont got 08

wen i try to use the for statement u gave me it says the "+" is not defined for type integer and coupons.aClass(this is my collection)

how do i define it...?
 
Runescape Gamblingrunescape gambling
Back
Top