Hello,
If I wanted to pass the two arrays below into a function and multiply them and return the two dimensional array how would I go about doing that? If anyone can give me an example I'll go with that. Thanks!
Public Class frmTotalDailySales
Dim ItemCost() As Decimal = {12D, 17.95D, 95D, 86.5D, 78D}
Dim SoldItems(,) As Integer
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
Dim strItemsSold As String = ""
Try
SoldItems = New Integer(,) {{CInt(txtS1I1.Text), CInt(txtS1I2.Text), CInt(txtS1I3.Text), CInt(txtS1I4.Text), CInt(txtS1I5.Text)}, _
{CInt(txtS2I1.Text), CInt(txtS2I2.Text), CInt(txtS2I3.Text), CInt(txtS2I4.Text), CInt(txtS2I5.Text)}, _
{CInt(txtS3I1.Text), CInt(txtS3I2.Text), CInt(txtS3I3.Text), CInt(txtS3I4.Text), CInt(txtS3I5.Text)}}
For r As Integer = 0 To SoldItems.GetUpperBound(0)
For c As Integer = 0 To SoldItems.GetUpperBound(1)
SoldItems(r, c) = CInt(SoldItems(r, c) * ItemCost(c))
strItemsSold &= FormatCurrency(SoldItems(r, c), 2) & vbTab
Next
strItemsSold &= vbCrLf & vbCrLf
Next
Catch ex As Exception
MessageBox.Show("textboxes must contain valid integers")
End Try
MessageBox.Show(strItemsSold, "Daily Sales Revenue")
End Sub
End Class