Public Class Form1
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim a As Integer = Val(TextBox1.Text)
        Dim b As Integer = Val(TextBox2.Text)
        Dim i, j
        Dim s As String = ""
        Dim C_One As Boolean


        For i = a To b
            C_One = True

            For j = 2 To i - 1
                If i Mod j = 0 Then
                    C_One = False
                    Exit For
                End If
            Next

            If C_One = True Then
                s = s & "  " & i
            End If
        Next

        RichTextBox1.Text = s
    End Sub
End Class
