Option Strict On Option Explicit On Public Class frmMain 'Variables global to the form Dim randNum1, randNum2 As Integer 'When the form loads... Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Acts like it is clicking the generate new range button btnNewRange.PerformClick() End Sub 'When the new range button is clicked... Private Sub btnNewRange_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNewRange.Click 'Generates new range and then displays the question in the question label, this time it does integers randNum1 = CInt(10.0 * Rnd()) randNum2 = randNum1 + CInt(10.0 * Rnd()) lblQuestion.Text = "Please enter a number between " & CStr(randNum1) & " and " & CStr(randNum2) End Sub 'When the submit button is clicked... Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click Dim answer As Double 'First checks if the answer in the text box is a number If IsNumeric(txtAnswer.Text) Then answer = CDbl(txtAnswer.Text) 'Then it checks if the answer is in the correct range, then displays appropriate message, also 'checks if the answer is exactly one of the numbers on the range If answer > randNum1 And answer < randNum2 Then MessageBox.Show("You are correct!", "You are correct!") ElseIf answer = randNum1 Then MessageBox.Show("Your answer is exactly the lower bound", "Kind of correct.") ElseIf answer = randNum2 Then MessageBox.Show("Your answer is exactly the upper bound", "Kind of correct.") Else MessageBox.Show("You are incorrect...", "You are incorrect...") End If Else MessageBox.Show("Please Enter a Valid Number", "Please Enter a Valid Number") End If End Sub End Class