Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

summing up user selected parts of an array + adding letters at end of integer+label

$
0
0
i have an array consisting of 34 entries, 0-33, i want to sum everyone from 0-21. i wrote this for loop thinking i solved the problem, but i realized it doesnt when the arrays change value
For i = 0 To 21
sum = sum + a(i)
Next

that gives me trouble if it first counts everything and gets a sum of 12, then if i sum it again, the sum will be previous array+new array

any input on how to do this? the arrays change all the time and i only want to display the sum of 0-21 and not the entire array of 33 or previous array+new array




also: i was doing this:
a(29) = Math.Round(Label24.Text / sum, 2)
Label34.Text = a(29) + "%"
and it says it cant convert % to double. but i thought it just added it to the end of the line then? so what am i missing? is it a double ++ or something else?

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>