Prime b

Prime b

  • NA
  • 810
  • 340.2k

Error with labels

Mar 11 2012 12:46 PM
  Dim dblItemPrice As Double
  Dim dblSubTotal As Double
  Dim dblSalesTax As Double
  Dim dblShipping As Double = 15
  Dim dblTotalDue As Double
  Dim constant As Double = 100

  Double.TryParse(txtInput.Text, dblItemPrice)
  Double.TryParse(lblTotalDueOut.Text, dblTotalDue)
  Double.TryParse(lblSalesTaxOut.Text, dblSalesTax)
  Double.TryParse(lblSubtotalOut.Text, dblSubTotal)
  If dblItemPrice < constant Then
  lblSubtotalOut.Text = dblItemPrice.ToString("C2")
  lblSalesTaxOut.Text = (dblItemPrice * 0.03).ToString("C2")
  lblShippingOut.Text = dblShipping.ToString("C2")
   lblTotalDueOut.Text = (dblShipping + dblSalesTax + dblSubTotal).ToString("C2")


The error is in this line, why when i add all this numbers it displays the first one only?


When the user clicks the Calculate Total button, the button's Click
event procedure should add the item price to the total of the prices
already entered; this amount represents the subtotal owed by the
customer. Th e procedure should display the subtotal on the form. It
also should display a 3% sales tax, the shipping charge, and the grand
total owed by the customer. Th e grand total is calculated by adding
together the subtotal, the 3% sales tax, and a $15 shipping charge.
For example, if the user enters 26.75 as the price and then clicks the
Calculate Total button, the button's Click event procedure should display
26.75 as the subtotal, 0.80 as the sales tax, 15.00 as the shipping
charge, and 42.55 as the grand total. If the user subsequently enters
30 as the price and then clicks the Calculate Total button, the button's
Click event procedure should display 56.75 as the subtotal, 1.70 as the
sales tax, 15.00 as the shipping charge, and 73.45 as the grand total.
However, when the subtotal is at least $100, the shipping charge is
0.00. Code the application. Save the solution and then start and test
the application. Close the Code Editor window and then close the
solution


Answers (3)