Hi,
I am just starting VB at 60 years old and with no programming experience and nobody to ask for help...except here, of course. So needless to say I am hitting brickwalls. I am using "Murach's Visual Basic 2008" and it seems to be a good book. This is what I am up to -
I have to declare an array with 5 elements with an index. I think that part is OK. Then add code that adds each element to the next one every time a user clicks a button. I have had many tries but the best I can get is just the grand total of the elements.Here is the code I came up with:-
Is anyone able to show me how the button click would reveal a progressive total of the elements each time a user clicked on it? It would be good if the book came with answers or had a forum for their readers. Grateful for any help but be gentle.Code:Private Sub btnCalculate_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles btnCalculate.Click Dim elements As Decimal Dim sum As Decimal Dim numbers() As Decimal = {350.49D, 546.73D, 123.45D, 56.85D, 752.69D} For Each elements In numbers sum += elements elements = 0 Next txtTotal.Text = FormatCurrency(sum)




Here is the code I came up with:-
Reply With Quote