因此,对于这个程序,任务是为汽车租赁公司创建一个程序。不同种类的汽车由单选按钮选择,汽车租赁成本(每天)乘以租赁天数。我已经按照书本做了所有事情,所以有什么问题?它不断出现我编码的消息框,告诉我我输入的数据不是数字(它是)
Dim decJeepWrangler As Decimal = 55D
Dim decLandRover As Decimal = 125D
Dim decPickup As Decimal = 85D
Dim intDays As Integer
Dim decTotalCost As Decimal
Dim decCost As Decimal
If IsNumeric(txtDays) Then
intDays = Convert.ToInt32(txtDays)
If intDays > 0 Then
If radJeepWrangler.Checked Then
decCost = decJeepWrangler
ElseIf radLandRover.Checked Then
decCost = decLandRover
ElseIf radPickup.Checked Then
decCost = decPickup
End If
decTotalCost = intDays * decCost
lblTotalCost.Text = decTotalCost.ToString("C")
Else
MsgBox("You entered " & intDays.ToString() & ". Enter a positive number", , "Input Error")
txtDays.Text = ""
txtDays.Focus()
End If
Else
MsgBox("Enter how many days you will be renting", , "Input Error")
txtDays.Text = ""
txtDays.Focus()
End If
End Sub