Sales figures not displayed in form
Posted
by
Brian Wilson
on Stack Overflow
See other posts from Stack Overflow
or by Brian Wilson
Published on 2013-10-22T18:38:56Z
Indexed on
2013/10/22
21:54 UTC
Read the original article
Hit count: 261
vb.net
Trying to calculate total sales for 5 items, 3 stores. Here's a s/s of what Im getting, along with my code. What am I missing/doing wrong? (p.s. It's not returning an error code in 'debug')
Public Class Form1
Private Sub btnCalc_Click(sender As Object, e As EventArgs) Handles btnCalc.Click
Dim ttlsales As Double
'set up array data
Dim sales(,) As Integer = {{25, 64, 23, 45, 14},
{12, 82, 19, 34, 63},
{54, 22, 17, 43, 35}}
Dim price() As Double = {12.0, 17.95, 95.0, 86.5, 78.0}
'mark totals
Dim totals(2) As Double
For store As Integer = 0 To 2
For item As Integer = 0 To 4
Next
Next
'display output
lstOut.Items.Add("Sales Per Store")
For store As Integer = 0 To 2
lstOut.Items.Add(store + 1 & ":" &
FormatCurrency(totals(store)))
ttlsales += totals(store)
Next
lstOut.Items.Add("Total Sales: " &
FormatCurrency(ttlsales))
End Sub
End Class
© Stack Overflow or respective owner