bcohenllc 0 Newbie Poster

Alright.. i figured out mostly everything but my math is still screwing me up. I need to accumulate running totals for number of checks and number of deposits ;and total value of checks and total value of deposits. Im supposed to do this by looping through my arrays and this is what I have so far:

Private Sub LoadArrayElements()

strTransDate(UBound(strTransDate)) = dtpTransDate.ToString
objCheckNum(UBound(objCheckNum)) = txtCheck.Text
strPayee(UBound(strPayee)) = txtPayee.Text
strPurpose(UBound(strPurpose)) = txtPurpose.Text
End Sub


Call LoadArrayElements()
'*Redim arrays to add new element
ReDim Preserve strTransDate(UBound(strTransDate) + 1)
ReDim Preserve objCheckNum(UBound(objCheckNum) + 1)
ReDim Preserve strPayee(UBound(strPayee) + 1)
ReDim Preserve strPurpose(UBound(strPurpose) + 1)
ReDim Preserve intAmount(UBound(intAmount) + 1)

sglAmount = Convert.ToSingle(txtAmount.Text)

'* Accumulate transaction count
ReDim Preserve intItemCount(UBound(intItemCount) + 1)
intItemCount(UBound(intItemCount)) = 1

'* Perform calculations
If radDeposit.Checked = True Then '* Transaction is a deposit
'* Accumulate totals
sglBalance += txtAmount.Text

Dim x As Integer = 0, i As Integer = 0
For i = 0 To intDepositAmount.GetUpperBound(0)
sglDepositAmount += intDepositAmount(i)
Next


Else '* Transaction is a check
'* Accumulate totals
sglBalance -= txtAmount.Text

Dim x As Integer = 0, i As Integer = 0
For i = 0 To intDepositAmount.GetUpperBound(0)
sglCheckAmount += intCheckAmount(i)
Next

End If '* End of transaction type test
'*
'* Display accumulated totals
'*
'* Overall totals
lblBalance.Text = FormatNumber(sglBalance, 2)
lblNumOfItems.Text = intItemCount.Length
'* Check totals
lblValueOfChecks.Text = FormatNumber(sglCheckAmount, 2)
lblNumOfChecks.Text = intCheckAmount.Length
'* Deposit totals
lblValueOfDeposits.Text = FormatNumber(sglDepositAmount, 2)
lblNumOfDeposits.Text = intDepositAmount.Length
'* Transfer input values to display labels
If radDeposit.Checked = True Then
lblType.Text = "Deposit"
Else
lblType.Text = "Check"
End If
lblTransDate.Text = dtpTransDate.Text
lblCheckNum.Text = txtCheck.Text
lblPayee.Text = txtPayee.Text
lblPurpose.Text = txtPurpose.Text
lblAmount.Text = FormatNumber(sglAmount, 2)
'* Reset input controls
'* Leaves transaction date at last value
radCheck.Checked = False
radDeposit.Checked = False
txtCheck.Text = ""
txtPayee.Text = ""
txtPurpose.Text = ""
txtAmount.Text = ""
'* Notify user of success
lblHelp.Text = "Transaction processed successfully"
End If '* End of processing for valid entries


My balance always comes out right and so does total number of items.. but my running totals for the checks and deposits come out to zero.. Please someone help! =) Thank you!