我正在创建一个每月固定服务费为10美元的银行应用程序,并按照他们存入的每张支票向人们收取一定数额的费用。对于20次以下的检查,他们收取0.10美元,20至39美元,0.08美元等等。我在“If”语句中出现语法错误,为程序创建逻辑。有谁能解释为什么?这是代码
Private Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click
Dim bankCharge As Integer = 10
Dim checks1 As Decimal = 0.1
Dim checks2 As Decimal = 0.08
Dim checks3 As Decimal = 0.06
Dim checks4 As Decimal = 0.04
Dim checks As Double
If Not Integer.TryParse(txtCheckBox.Text, checks) Then
MessageBox.Show("This is not a number!")
End If
If txtCheckBox.Text < 20 Then
(checks * checks1 + bankCharge = lblFeeTotal) 'the error starts HERE
End If
End Sub
答案 0 :(得分:0)
如果要分配值lblFeeTotal,则代码是向后的。试试
lblFeeTotal = (checks * checks1 + bankCharge)
假设lblFeeTotal存在并且是计算的变量。如果它用于显示(例如:文本框),则代码为:
lblFeeTotal.Text = (checks * checks1 + bankCharge)
答案 1 :(得分:0)
此声明已回到正面
(检查* checks1 + bankCharge = lblFeeTotal)&#39;错误从这里开始
应该写成
lblFeeTotal =(检查* checks1 + bankCharge)
如果lblFeeTotal是LABEL CONTROL 然后你可以把它写成....
lblFeeTotal.text =(检查* checks1 + bankCharge)