如何纠正消息框错误并上下编码数字?

时间:2019-04-26 02:07:02

标签: vb.net

我正在学校的Visual Studio中从事项目工作,无法弄清一些事情。我是编程新手,已经研究了数周,但是一直遇到错误。

  1. 超过$ 300的订单将显示一个错误消息框,指出需要经理批准。 (我有这部分)。经理必须在txtName字段中输入单词APPROVED才能批准订单,这是不起作用的部分。

我必须在3分钟内以每分钟$ 3的价格提供向上和向下的数字,最多90分钟。我根本无法使用它。

弹出错误消息框后,

订单仍在处理。

我的错误消息正在运行,但是只要我按OK确认错误,订单仍然会显示。

Dim strName As String = ""
Dim decTotalCost As Decimal = 0D
Dim decSkinCareCost As Decimal = 0D
Dim decNailCareCost As Decimal = 0D
Dim decWaxingCost As Decimal = 0D

Const FACIAL_PRICE As Decimal = 90D
Const MICRO_PRICE As Decimal = 120D
Const CHEM_PEEL_PRICE As Decimal = 130D
Const MANI_PRICE As Decimal = 25D
Const PEDI_PRICE As Decimal = 55D 
Const MANI_PEDI_PRICE As Decimal = 75D
Const EYEBROW_WAX_PRICE As Decimal = 20D
Const LIP_WAX_PRICE As Decimal = 15D
Const CHIN_WAX_PRICE As Decimal = 15D 
Const JAW_WAX_PRICE As Decimal = 20D
Const ARM_WAX_PRICE As Decimal = 45D
Const UNDER_ARM_WAX_PRICE As Decimal = 20D
Const FEET_HANDS_WAX_PRICE As Decimal = 15D
Const LEG_WAX_PRICE As Decimal = 65D
Const NONE_FACE As Decimal = 0D
Const NONE_NAILS As Decimal = 0D

Const strNO_SERVICES_SELECTED_ERROR As String = "ERROR: Please select a 
service."
Const strORDER_OVER_300_ERROR As String = "ERROR: Order over $300, please 
see manager for approval"
Const strNO_NAME_ERROR As String = "ERROR:  Please enter a name."

Dim strNoNameMessage As String = strNO_NAME_ERROR
Dim strManagerApproval As String = strORDER_OVER_300_ERROR
Dim strNoServicesSelected As String = strNO_SERVICES_SELECTED_ERROR

Private Sub btnSubmit_Click(sender As Object, e As EventArgs) Handles 
btnSubmit.Click
    If txtName.Text <> "" Then
        If radFacial.Checked = True Then
            decTotalCost = decTotalCost + FACIAL_PRICE
        ElseIf radMicro.Checked = True Then
            decTotalCost = decTotalCost + MICRO_PRICE
        ElseIf radChemPeel.Checked = True Then
            decTotalCost = decTotalCost + CHEM_PEEL_PRICE
        ElseIf radNoneFace.Checked = True Then
            decTotalCost = NONE_FACE
        End If
        If radMani.Checked = True Then
            decTotalCost = decTotalCost + MANI_PRICE
        ElseIf radPedi.Checked = True Then
            decTotalCost = decTotalCost + PEDI_PRICE
        ElseIf radManiPedi.Checked = True Then
            decTotalCost = decTotalCost + MANI_PEDI_PRICE
        ElseIf radNoneNails.Checked = True Then
            decTotalCost = NONE_NAILS
        End If
        If chkEyebrow.Checked = True Then
            decTotalCost = decTotalCost + EYEBROW_WAX_PRICE
        End If
        If chkLip.Checked = True Then
            decTotalCost = decTotalCost + LIP_WAX_PRICE
        End If
        If chkChin.Checked = True Then
            decTotalCost = decTotalCost + CHIN_WAX_PRICE
        End If
        If chkJaw.Checked = True Then
            decTotalCost = decTotalCost + JAW_WAX_PRICE
        End If
        If chkArm.Checked = True Then
            decTotalCost = decTotalCost + ARM_WAX_PRICE
        End If
        If chkUnderArm.Checked = True Then
            decTotalCost = decTotalCost + UNDER_ARM_WAX_PRICE
        End If
        If chkFeetHands.Checked = True Then
            decTotalCost = decTotalCost + FEET_HANDS_WAX_PRICE
        End If
        If chkLeg.Checked = True Then
            decTotalCost = decTotalCost + LEG_WAX_PRICE
        End If

        If decTotalCost > 300D Then
            MsgBox(strORDER_OVER_300_ERROR)
            txtName.Focus()
        ElseIf decTotalCost = 0D Then
            MsgBox(strNO_SERVICES_SELECTED_ERROR)
        End If

        MsgBox("Thank you, " & txtName.Text & " Your Spa total is: " & 
        decTotalCost.ToString("C"))
    Else
        txtName.Text = ""
        MsgBox(strNO_NAME_ERROR)
    End If
End Sub

Private Sub NumericUpDown1_ValueChanged(sender As Object, e As EventArgs) 
Handles NumericUpDown1.ValueChanged

0 个答案:

没有答案