用VB编程在文本框text1中输出100~200之间的所有素数

来源:百度知道 编辑:UC知道 时间:2024/05/11 18:06:26
能不能写出完整的代码,要在文本框中输出,而不是在form窗体中输出结果

'添加窗体Form1,文本框Text1,按钮Command1,然后添加如下代码:
Private Sub Command1_Click()
    Dim b As Boolean
    Dim i, j As Integer
    For i = 100 To 200
        DoEvents
        b = True
        For j = 2 To i - 1
            If i Mod j = 0 Then
                b = False
                Exit For
            End If
 &