The original code you posted is only comparing the text values. Not the numeric values in there.Code:Dim Rng1 = TextBox1.Text Dim Rng2 = TextBox2.Text Dim Rand As New System.Random(Now.Millisecond) If TextBox1.Text = "" Or TextBox2.Text = "" Or TextBox1.Text = "0" Or TextBox2.Text = "0" Then MessageBox.Show("Range must be positive numbers!", "Input Error") ElseIf Val(TextBox1.Text) <= Val(TextBox2.Text) Then MessageBox.Show(TextBox2.Text & "is less than" & TextBox1.Text, "Range Error") Else Label1.Text = Rand.Next(Rng1, Rng2 + 1) End If




Reply With Quote