Hola,fijate si te sirve esto:
Código:
Public Class Form1
Dim x As Integer
Dim i As Integer
Dim a As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
i = Val(TextBox1.Text)
a = Val(TextBox2.Text)
Label1.Text = ""
For x = i To a
If Primo(x) = True Then
Label1.Text = Label1.Text & x & " "
End If
Next
End Sub
Function Primo(ByVal Nro As Integer) As Boolean
Dim i As Integer
For i = 2 To Nro / 2
If Nro Mod i = 0 Then
Primo = False
Exit Function
End If
Next
Primo = True
End Function
End Class
tambien le podrias poner que en el text1 no pueda escribir el 0 o el 1,ya que el primer primo es el 2.
saludos.