Private Sub btnDisplay_Click(...) Handles btnDisplay.Click \'Is your program cor
ID: 3630340 • Letter: P
Question
Private Sub btnDisplay_Click(...) Handles btnDisplay.Click'Is your program correct?
Dim query, answer1, answer2 As String
query = "Are you sure everything in your program is correct?"
answer1 = InputBox(query)
answer1 = answer1.ToUpper.Substring(0, 1)
If answer1 = "N" Then
txtOutput.Text = "Don't patch bad code, rewrite it."
Else
query = "Does your program run correctly?"
answer2 = InputBox(query)
answer2 = answer2.ToUpper.Substring(0, 1)
If answer2 = "Y" Then
txtOutput.Text = "Congratulations."
Else
txtOutput.Text = "Something you are sure about is wrong."
End If
End Sub
Explanation / Answer
Private Sub btnDisplay_Click(sender As Object, e As System.EventArgs) Handles btnDisplay.Click 'Is your program correct? Dim query, answer1, answer2 As String query = "Are you sure everything in your program is correct?" answer1 = InputBox(query) answer1 = answer1.ToUpper.Substring(0, 1) If answer1 = "N" Then txtOutput.Text = "Don't patch bad code, rewrite it." Else query = "Does your program run correctly?" answer2 = InputBox(query) answer2 = answer2.ToUpper.Substring(0, 1) If answer2 = "Y" Then txtOutput.Text = "Congratulations." Else txtOutput.Text = "Something you are sure about is wrong." End If End If 'Add end if End Sub
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.