Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Private Sub btnCalculate_Click (sender As Object, e As EventArgs) Handles btnCal

ID: 3671921 • Letter: P

Question

Private Sub btnCalculate_Click (sender As Object, e As EventArgs) Handles btnCalculate.Click Dim Runner1Time As Integer Dim Runner2Time As Integer Dim Runner3Time As Integer Dim NotInt As Integer Runner!Time = CInt(val(txtTime1 . Text)) Runner2Time = CInt (val(txtTime2 . Text)) Runner3Time = CInt (val(txtTime3 . Text)) If txtR1.TextOr txtR2.Text Or txtR3.TextThen MsgBox("Runner name cannot be blank", MsgBoxStyle.Critical) End If If Not Integer.TryParse(txtTime1.Text, NotInt) Or Not Integer.TryParse(txtTime3.Text, NotInt) Or Not Integer.TryParse(txtTime2. Text, NotInt) Then MsgBox("Time should be numeric") Elself Runner!Time

Explanation / Answer

There are minor errors in your code:

I am giving you only corrected code (highlighted)

If (( Not Integer.TryParse(textTime1.Text, NotInt)) Or ( Not Integer.TryParse(textTime3.Text, NotInt)) Or ( Not Integer.TryParse(textTime2.Text, NotInt)))

Then

MsgBox("Time should be numeric")

ElseIf ((Runner1Time <0) Or (Runner2Time<0) Or (Runner3Time<0))

Then

MsgBox("The values cannot be negative")

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote