我在弄清楚此代码的问题所在时遇到了麻烦。我的计算可以正常工作,直到最后一种情况(CASE IS> 8)为止,该情况连续返回0.00。我敢肯定,由于缺乏经验,像我这样的新手不见了。谢谢您的帮助!

'变量声明

Convert.ToInt32(txtAttending.Text)
Dim decAttending = txtAttending.Text

If IsNumeric(txtAttending.Text) And txtAttending.Text <= 16 Then
    Select Case txtAttending.Text
        Case Is = 1
            decCost = 695 * decAttending
        Case 2 To 4
            decCost = 545 * decAttending
        Case 5 To 8
            decCost = 480 * decAttending
        Case Is > 8
            decCost = 395 * decAttending
    End Select
Else
    MsgBox("Please double check that your input is a number not greater than 16", , "Input Error")

End If

If radYes.Checked = True Then
    decFinalCost = (decCost - (decCost * 0.15))
    lblRepeatDiscount.Visible = True
    decDiscount = (decCost * 0.15)
    lblDiscount.Text = decDiscount.ToString("C")
    lblTotalPrice.Text = decFinalCost.ToString("C")

Else
    decFinalCost = decCost
    lblTotalPrice.Text = decFinalCost.ToString("C")
End If

最佳答案

Case Else
        decCost = 395 * decAttending

关于vb.net - VB 2010中的计算问题,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9969550/

10-11 04:59