jason12349 0 Newbie Poster

Hi, Im looking for any kind of nudge in the right direction. In this vb.net program I have declared 3 private variables, quantity, weight, and price. I will then type the following into textboxes and when I click the "add this item" button the info will be displayed into 3 matching labels. I coded so it will accumulate each order until done. Then there is an update summary button, this button shows the dollar amount due(price * quantity), sales tax, shipping and handling and then total amount due. Im almost done with this but I am having a problem with accumulating dollar amount due and shipping and handling. So far it will only calculate dollar amount due and shipping for one order only. When I type in multiple orders it will only give dollar amount due, etc, for the first one. I need to a know a way I could get the orders to accumulate in a variable but I just can 't figure out anything that works. Below I have copied some of the code for the addthisitem button and the update summary button.
Any help would be greatly appreciated.

Private Sub additemButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles additemButton.Click

Dim descriptionString As String
With Me
quantityDecimal = Decimal.Parse(.quantityTextBox.Text)
weightDecimal = Decimal.Parse(.weightTextBox.Text)
priceDecimal = Decimal.Parse(.priceTextBox.Text)
descriptionString = .productTextBox.Text
'Display and accumulate variables accordingly

.descriptionresultLabel.Text += vbNewLine & descriptionString.ToString
.quantityresultLabel.Text += vbNewLine & quantityDecimal.ToString
.weightresultLabel.Text += vbNewLine & weightDecimal.ToString
.priceresultLabel.Text += vbNewLine & priceDecimal.ToString


End With


End Sub

Private Sub updatesummaryButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles updatesummaryButton.Click
'Declare variables
Dim amountdueDecimal, handlingDecimal As Decimal
Dim shippingDecimal As Decimal
Dim salestaxDecimal, totalshippingDecimal As Decimal
Dim isConverted As Boolean
Dim isConverted2, isConverted3 As Boolean
With Me

isConverted = Decimal.TryParse(.quantityTextBox.Text, quantityDecimal)


If isConverted Then
isConverted2 = Decimal.TryParse(.priceTextBox.Text, priceDecimal)
'find a place for the below variables

If isConverted2 Then


amountdueDecimal += priceDecimal * quantityDecimal
salestaxDecimal = priceDecimal * quantityDecimal * 0.08D

Else : MessageBox.Show("Please enter non-zero values.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
With .priceTextBox
.Focus()
'Declaring boolean variable for shipping and handling calculations(last left off here)

isConverted3 = Decimal.TryParse(weightTextBox.Text, weightDecimal)
weightDecimal = weightDecimal * quantityDecimal


If isConverted3 Then
If weightDecimal < 10D Then
handlingDecimal = 1D
ElseIf weightDecimal >= 10D And weightDecimal <= 100 Then
handlingDecimal = 3D
ElseIf weightDecimal > 100D Then
handlingDecimal = 5D
End If


'display results

End If
End With

End If
'Display the shipping and handling total

shippingDecimal = weightDecimal * 0.25D

totalshippingDecimal = shippingDecimal + handlingDecimal

.resultLabel.Text = "Dollar Amount Due " & amountdueDecimal.ToString _
& vbNewLine & "Sales Tax " & salestaxDecimal.ToString & vbNewLine & _
"Shipping and Handling " & totalshippingDecimal.ToString
Else
MessageBox.Show("Please enter non-zero values.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
With .quantityTextBox

End With
.Focus()
End If


End With