Option Strict On Option Explicit On Public Class frmMain 'Variables global to the form Dim randNum1, randNum2 As Single '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 randNum1 = Rnd() randNum2 = randNum1 + 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 If answer > randNum1 And answer < randNum2 Then MessageBox.Show("You are correct!", "You are 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