Ive made a program in vb to check to see if a number is a prime number, i was wondering what people thought was the best and fastest way to find the prime number at the moment i have:

Dim prime As Double

Dim temp As Double

Dim current As Double

Dim root As Double

Private Sub Command1_Click()

prime = Text1.Text

If prime = 1 Or prime = 2 Then

MsgBox "error"

Exit Sub

End If

current = 2

root = Sqr(prime) + 1

Do

temp = prime Mod current

If temp = 0 Then

MsgBox "not a prime"

Exit Sub

End If

current = current + 1

Loop Until current = root

MsgBox "prime"

End Sub

Has any one got any ideas?

thanx trials