this is a very simple code to check the number is prime or not
Dim i, j As Integer
Dim t As Boolean
i = TextBox1.Text
t = True
For j = 2 To (i - 1)
If i Mod j = 0 Then
t = False
Exit For
End If
Next j
If t Then
MsgBox(i & " is a prime Number")
Else
MsgBox(i & " is not a prime Number")
End If
www.ram-a-singh.blogspot.com