I want to create a program in Visual Studio 2017. Here is the code so far: Public Class…
- User
I want to create a program in Visual Studio 2017. Here is the code so far: Public Class frmTube
Private Sub btnCost_Click(sender As Object, e As EventArgs) Handles btnCost.Click Dim decZones1to3 As Decimal = 4.9 Dim decZones1to5 As Decimal = 5.9 Dim decZones1to6 As Decimal = 6 Dim decConversionRate As Decimal = 1.2872363 Dim decAmtOfTickets As Int32 Dim decTotalCost As Decimal Dim decZoneCost As Decimal Dim decCostUSD As Decimal If IsNumeric(txtAmtOfTickets.Text) Then decAmtOfTickets = Convert.ToInt32(txtAmtOfTickets.Text) If decAmtOfTickets > 0 Then If radZone1to3.Checked Then decZoneCost = decZones1to3 ElseIf radZone1to5.Checked Then decZoneCost = decZones1to5 ElseIf radZone1to6.Checked Then decZoneCost = decZones1to6 End If decTotalCost = decAmtOfTickets * decZoneCost decCostUSD = decTotalCost * 1.2873886 lblTotalCost.Text = "Your Total Cost will be £" + decTotalCost.ToString("F2") + " or $" + decCostUSD.ToString("F2") End If If IsNumeric(txtAmtOfTickets.Text) = False Then MsgBox("Enter the number of tickets", , "Input Error") txtAmtOfTickets.Text = "" txtAmtOfTickets.Focus() ElseIf txtAmtOfTickets.Text IsNot = False Then MsgBox("Enter a whole number", , "Input Error") txtAmtOfTickets.Text = "" txtAmtOfTickets.Focus() End If End If End Sub Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click txtAmtOfTickets.Clear() lblTotalCost.Text = "" radZone1to3.Checked = True radZone1to5.Checked = False radZone1to6.Checked = False txtAmtOfTickets.Focus() End Sub Private Sub frmTube_Load(sender As Object, e As EventArgs) Handles MyBase.Load txtAmtOfTickets.Focus() lblTotalCost.Text = "" End SubEnd Class
Everything works except Line 32. I was trying to make it so that an error message would display if I entered a decimal in the program. How would i do that?
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.