したがって、このプログラムのタスクは、レンタカー会社向けのプログラムを作成することです。さまざまな種類の車をラジオ ボタンで選択し、レンタルする車の費用 (1 日あたり) にレンタルする日数を掛けます。私は本ですべてをやったので、何が悪いのですか?入力しているデータが数値ではないことを伝える、コーディングしたメッセージボックスが表示され続けます(数値です)
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