以下是我正在尝试的代码:
If txtMonths >= 1 And txtMonths <= 6 Then
additionalDiscount = 0
答案 0 :(得分:4)
intMonths
是TextBox
,而非int
,因此您无法将其用作int
。您必须提取其文本值并首先将其转换为int
:
Dim intMonthsVal As Integer = Integer.Parse(txtMonths.Text)
If intMonthsVal >= 1 AndAlso intMonthsVal <= 6 Then
additionalDiscount = 0
End If