0

Im working on an app that takes two numbers(lower bound and upperbound)and determines all the prime numbers within the specific bounds, inclusive.

```
Public Class primeNumber
Private Sub calculatePrimesButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles calculatePrimesButton.Click
'declare variables
Dim N As Long
Dim LowerBound As Integer
Dim UpperBound As Integer
Dim i As Integer = 0
'user input
LowerBound = Val(lowerboundTextBox1.Text)
UpperBound = Val(upperboundTextBox2.Text)
'display error message when user inputs an upperbound that is less than lower bound
If UpperBound < LowerBound Then
MessageBox.Show("Upper Bound cannot be less than Lower Bound", "Invalid Bounds", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
'declare an array that will store the prime numbers gotten
For i = LowerBound To UpperBound
If IsPrime(N) = True Then
primeTextBox.Text = N
End If
Next
End Sub
Private Function IsPrime(ByVal number As Long) As Boolean
If number = 2 Then
Return True
Else
For i = 1 To number \ 2
If number Mod i = 0 Then
Return False
End If
Next
End If
Return True
End Function
End Class
```

I know i need to get the statment that counts from 2 to the square root of the number, and use the mod op in the body of the for next loop. Ive done something similar to that but i think im missing the square root and someething else in my function, or is in my main code?