The way your example is coded, which is telling me everything is prime it seems like it is looking to see if a number is divisible by anything without a remander.

What you are doing is not finding prime numbers, but rather just looking to see what the number is evenly divisible by.

You have two main problems that I see, your if statements need to be inside the for...next statement, otherwise they just work with the last result.

Secondly your if else statements are not looking for number of divisors, they are rather looking for the remander.

```
lbDivisions.Items.Clear()
'declaring variables
Dim IntRemainder As Integer
Dim IntNumber As Integer = txtInt.Text
Dim intDiv As Integer
'IF statement to determine prime or not prime
For intDiv = 1 To 100 Step 1
IntRemainder = IntNumber Mod intDiv
If IntRemainder = 0 Then
lbDivisions.Items.Add(intDiv)
End If
Next intDiv
If lbDivisions.Items.Count = 2 Then
lblPrime.Text = "Prime"
Else
lblPrime.Text = "Not Prime"
End If
```

This way the code finds the divisors that divide evenly, and adds them to the list, then it checks the list to see how many numbers are there. If there are only two numbers it is logically prime, any more than two and it can not be prime, and less and the number is one which is arguably not prime.

On the second next statement for my code, your code uses a user imput (eg x = 3) and searches for all even divisors for it. My code works by searching for all numbers in the first range (eg x = 2 -10) and then does what your code does and looks for even divisors. With a little modification, your code can be wrapped into my code to have the same result.

```
' declarations
Dim IntRemainder As Integer
Dim IntNumber As Integer
Dim intDiv As Integer
For IntNumber = 1 To 100 ' this first number replaces the text box
For intDiv = 1 To 100 ' this number is the divisor
' calculates and checks value at the same time
If IntNumber Mod intDiv = 0 Then
lbDivisions.Items.Add(intDiv)
End If
Next intDiv ' goes back and tries another divisor
'checks to see if their are more than two even divisors and adds it to the label if it is prime
If lbDivisions.Items.Count = 2 Then
lblPrime.Text &= IntNumber & ", "
End If
' gets ready for the next dividend
lbDivisions.Items.Clear()
Next
```

Walla, the label displays all numbers that are prime. You could also have a second listbox, instead of the label.