W
Willdthrill
Guest
Im a student currently learning Visual Basic. I have coded and made this application for a "salon" offers 4 choices (buttons) Haircut, pedicure, manicure and facial. all with separate prices and it should have a accumulating total so that when haircut is chosen then manicure the subtotal and tax boxes should adjust to the new price. I have the Total correct it adds up correctly when all boxes are chosen where as the subtotal boxes and tax box only show the amount for the individual selection. I can not figure out why the total adds up correctly but the subtotal and tax doesnt.
Option Strict On
Public Class frmSalonSpa
Const _cDecTax As Decimal = 0.07D
Const _cDecCostOfFacial As Decimal = 8D
Const _cDecCostOfPedicure As Decimal = 15D
Const _cDecCostOfManicure As Decimal = 10D
Const _cDecCostOfHaircut As Decimal = 5D
Dim _cDecTax2 As Decimal = 0
Dim _cDecTotal As Decimal = 0
Dim _cDecSubTotal As Decimal = 0
Private Const V As Decimal = 0
Private Sub btnHaircut_Click(sender As Object, e As EventArgs) Handles btnHaircut.Click
_cDecSubTotal = _cDecCostOfHaircut + _cDecSubTotal
lblSubtotal.Text = _cDecSubTotal.ToString("C2")
lblSubtotal.Text = _cDecCostOfHaircut.ToString("C2")
_cDecTax2 = _cDecTax * _cDecCostOfHaircut
lblTax.Text = _cDecTax2.ToString("C2")
lblTax.Text = _cDecTax2.ToString("C2")
_cDecTotal = _cDecTax2 + _cDecSubTotal
lblTotal.Text = _cDecCostOfHaircut.ToString("C2")
lblTotal.Text = _cDecTotal.ToString("C2")
btnHaircut.Enabled = False
btnMakeAppointment.Enabled = True
btnReset.Enabled = True
End Sub
Private Sub btnManicure_Click(sender As Object, e As EventArgs) Handles btnManicure.Click
_cDecSubTotal = _cDecCostOfManicure + _cDecSubTotal
_cDecTax2 = _cDecTax * _cDecCostOfManicure
_cDecTotal = _cDecTax + _cDecSubTotal
lblSubtotal.Text = _cDecSubTotal.ToString("C2")
lblSubtotal.Text = _cDecCostOfManicure.ToString("C2")
lblTotal.Text = _cDecCostOfManicure.ToString("C2")
lblTotal.Text = _cDecTotal.ToString("C2")
lblTax.Text = _cDecTax2.ToString("C2")
btnManicure.Enabled = False
btnMakeAppointment.Enabled = True
btnReset.Enabled = True
End Sub
Private Sub btnPedicure_Click(sender As Object, e As EventArgs) Handles btnPedicure.Click
_cDecSubTotal = _cDecCostOfPedicure + _cDecSubTotal
_cDecTax2 = _cDecTax * _cDecCostOfPedicure
_cDecTotal = _cDecTax2 + _cDecSubTotal
lblSubtotal.Text = _cDecSubTotal.ToString("C2")
lblSubtotal.Text = _cDecCostOfPedicure.ToString("C2")
lblTotal.Text = _cDecCostOfPedicure.ToString("C2")
lblTotal.Text = _cDecTotal.ToString("C2")
lblTax.Text = _cDecTax2.ToString("C2")
btnPedicure.Enabled = False
btnMakeAppointment.Enabled = True
btnReset.Enabled = True
End Sub
Private Sub btnFacial_Click(sender As Object, e As EventArgs) Handles btnFacial.Click
_cDecSubTotal = _cDecCostOfFacial + _cDecSubTotal
_cDecTax2 = _cDecTax * _cDecCostOfFacial
_cDecTotal = _cDecTax2 + _cDecSubTotal
lblSubtotal.Text = _cDecSubTotal.ToString("C2")
lblSubtotal.Text = _cDecCostOfFacial.ToString("C2")
lblTotal.Text = _cDecCostOfFacial.ToString("C2")
lblTotal.Text = _cDecTotal.ToString("C2")
lblTax.Text = _cDecTax2.ToString("C2")
btnFacial.Enabled = False
btnMakeAppointment.Enabled = True
btnReset.Enabled = True
End Sub
Private Sub btnReset_Click(sender As Object, e As EventArgs) Handles btnReset.Click
' This code resets the selected buttons
btnHaircut.Enabled = True
btnManicure.Enabled = True
btnPedicure.Enabled = True
btnFacial.Enabled = True
btnReset.Enabled = False
btnMakeAppointment.Enabled = False
lblTotal.Text = CType(V, String)
lblSubtotal.Text = CType(V, String)
lblTax.Text = CType(V, String)
End Sub
Private Sub btnMakeAppointment_Click(sender As Object, e As EventArgs) Handles btnMakeAppointment.Click
' This code resets the choices and we assume that the appointent is made.
btnHaircut.Enabled = True
btnManicure.Enabled = True
btnPedicure.Enabled = True
btnFacial.Enabled = True
btnReset.Enabled = False
btnMakeAppointment.Enabled = False
lblTotal.Text = CType(V, String)
lblSubtotal.Text = CType(V, String)
lblTax.Text = CType(V, String)
End Sub
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs)
End Sub
Continue reading...
Option Strict On
Public Class frmSalonSpa
Const _cDecTax As Decimal = 0.07D
Const _cDecCostOfFacial As Decimal = 8D
Const _cDecCostOfPedicure As Decimal = 15D
Const _cDecCostOfManicure As Decimal = 10D
Const _cDecCostOfHaircut As Decimal = 5D
Dim _cDecTax2 As Decimal = 0
Dim _cDecTotal As Decimal = 0
Dim _cDecSubTotal As Decimal = 0
Private Const V As Decimal = 0
Private Sub btnHaircut_Click(sender As Object, e As EventArgs) Handles btnHaircut.Click
_cDecSubTotal = _cDecCostOfHaircut + _cDecSubTotal
lblSubtotal.Text = _cDecSubTotal.ToString("C2")
lblSubtotal.Text = _cDecCostOfHaircut.ToString("C2")
_cDecTax2 = _cDecTax * _cDecCostOfHaircut
lblTax.Text = _cDecTax2.ToString("C2")
lblTax.Text = _cDecTax2.ToString("C2")
_cDecTotal = _cDecTax2 + _cDecSubTotal
lblTotal.Text = _cDecCostOfHaircut.ToString("C2")
lblTotal.Text = _cDecTotal.ToString("C2")
btnHaircut.Enabled = False
btnMakeAppointment.Enabled = True
btnReset.Enabled = True
End Sub
Private Sub btnManicure_Click(sender As Object, e As EventArgs) Handles btnManicure.Click
_cDecSubTotal = _cDecCostOfManicure + _cDecSubTotal
_cDecTax2 = _cDecTax * _cDecCostOfManicure
_cDecTotal = _cDecTax + _cDecSubTotal
lblSubtotal.Text = _cDecSubTotal.ToString("C2")
lblSubtotal.Text = _cDecCostOfManicure.ToString("C2")
lblTotal.Text = _cDecCostOfManicure.ToString("C2")
lblTotal.Text = _cDecTotal.ToString("C2")
lblTax.Text = _cDecTax2.ToString("C2")
btnManicure.Enabled = False
btnMakeAppointment.Enabled = True
btnReset.Enabled = True
End Sub
Private Sub btnPedicure_Click(sender As Object, e As EventArgs) Handles btnPedicure.Click
_cDecSubTotal = _cDecCostOfPedicure + _cDecSubTotal
_cDecTax2 = _cDecTax * _cDecCostOfPedicure
_cDecTotal = _cDecTax2 + _cDecSubTotal
lblSubtotal.Text = _cDecSubTotal.ToString("C2")
lblSubtotal.Text = _cDecCostOfPedicure.ToString("C2")
lblTotal.Text = _cDecCostOfPedicure.ToString("C2")
lblTotal.Text = _cDecTotal.ToString("C2")
lblTax.Text = _cDecTax2.ToString("C2")
btnPedicure.Enabled = False
btnMakeAppointment.Enabled = True
btnReset.Enabled = True
End Sub
Private Sub btnFacial_Click(sender As Object, e As EventArgs) Handles btnFacial.Click
_cDecSubTotal = _cDecCostOfFacial + _cDecSubTotal
_cDecTax2 = _cDecTax * _cDecCostOfFacial
_cDecTotal = _cDecTax2 + _cDecSubTotal
lblSubtotal.Text = _cDecSubTotal.ToString("C2")
lblSubtotal.Text = _cDecCostOfFacial.ToString("C2")
lblTotal.Text = _cDecCostOfFacial.ToString("C2")
lblTotal.Text = _cDecTotal.ToString("C2")
lblTax.Text = _cDecTax2.ToString("C2")
btnFacial.Enabled = False
btnMakeAppointment.Enabled = True
btnReset.Enabled = True
End Sub
Private Sub btnReset_Click(sender As Object, e As EventArgs) Handles btnReset.Click
' This code resets the selected buttons
btnHaircut.Enabled = True
btnManicure.Enabled = True
btnPedicure.Enabled = True
btnFacial.Enabled = True
btnReset.Enabled = False
btnMakeAppointment.Enabled = False
lblTotal.Text = CType(V, String)
lblSubtotal.Text = CType(V, String)
lblTax.Text = CType(V, String)
End Sub
Private Sub btnMakeAppointment_Click(sender As Object, e As EventArgs) Handles btnMakeAppointment.Click
' This code resets the choices and we assume that the appointent is made.
btnHaircut.Enabled = True
btnManicure.Enabled = True
btnPedicure.Enabled = True
btnFacial.Enabled = True
btnReset.Enabled = False
btnMakeAppointment.Enabled = False
lblTotal.Text = CType(V, String)
lblSubtotal.Text = CType(V, String)
lblTax.Text = CType(V, String)
End Sub
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs)
End Sub
Continue reading...