I have 5 items in a listbox, and I want to have the total of those items saved to variable that I can use later?
How do I add those items up to a variable?
Printable View
I have 5 items in a listbox, and I want to have the total of those items saved to variable that I can use later?
How do I add those items up to a variable?
vb Code:
Dim total As Integer = 0 For Each item As Integer In myListBox.Items total += item Next item MessageBox.Show("Total = " & total)
Ok say I have 5 numbers
1
4
5
3
2
I want 15 to be stored as a variable in the form so I can use it with a DIFFERENT event procedure?
I've already given you the solution.