出于某种原因,第一个"如果"声明在我调试时工作,但当我尝试任何其他单选按钮或使用相同的按钮但尝试制作第二个"如果"陈述是真的,我点击"计算奖励积分"按钮,但它不计算。它只计算第一个" If"声明。这是我的代码。如果我的行话没有达到标准,我道歉。我只参加这门课,因为它是必需的。我附上
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Const basic1 As Double = 0.03
Const basic2 As Double = 0.05
Const basic3 As Double = 0.08
Const basic4 As Double = 0.1
Const basic5 As Double = 0.15
Dim totalLabel As Double
Dim doubleReward As Double
Double.TryParse(RewardDisplay.Text, doubleReward)
Double.TryParse(TotalTextBox.Text, totalLabel)
If basicRadioButton.Checked AndAlso totalLabel < 100 Then
RewardDisplay.Text = totalLabel * basic1
ElseIf basicRadioButton.Checked AndAlso totalLabel < 200 or >= 100 Then
RewardDisplay.Text = totalLabel * basic2
ElseIf basicRadioButton.Checked AndAlso totalLabel >= 200 Then
RewardDisplay.Text = totalLabel * basic3
ElseIf standardRadioButton.Checked AndAlso totalLabel < 199 Then
RewardDisplay.Text = totalLabel * basic3
ElseIf standardRadioButton.Checked AndAlso totalLabel >= 200 Then
RewardDisplay.Text = totalLabel * basic4
ElseIf premiumRadioButton.Checked AndAlso totalLabel < 299 Then
RewardDisplay.Text = totalLabel * basic4
ElseIf premiumRadioButton.Checked AndAlso totalLabel >= 300 Then
RewardDisplay.Text = totalLabel * basic5
End If
End Sub
答案 0 :(得分:0)
您必须在调试模式下查看变量的值 basicRadioButton.Checked和totalLabel来理解为什么算法没有达到你期望的效果。 简化您的代码,也许可以做一些链接这个
roosterlegs@roosterlegs-Lenovo-Y50-70:~/vagrant_proj$ VBoxManage --version
WARNING: The character device /dev/vboxdrv does not exist.
Please install the virtualbox-dkms package and the appropriate
headers, most likely linux-headers-generic.
You will not be able to start VMs until this problem is fixed.
5.0.18_Ubuntur106667
这有助于您找到错误。