|
![]() | 作者: shen [shen]
![]() |
登录 |
Private Sub Command1_Click() Label1(1).Visible = False n = 100 For i = 2 To Sqr(n) If Label1(i).Visible = True Then MsgBox "现在开始删去" & Str(i) & "的倍的数", vbInformation, "用<筛法>找素数" For j = i + 1 To n If Label1(j).Visible = True And j Mod i = 0 Then Label1(j).Visible = False End If Next End If Next MsgBox "剩下来的整数已全都是素数!", vbInformation, "用<筛法>找素数" End Sub Private Sub Command2_Click() For n = 1 To 100 Label(n).Visible = True Next End Sub Private Sub Form_Load() Picture1.Move 0, 0 Picture1.Height = (Label1(0).Height + 5) * 10 + 3 Picture1.Width = (Label1(0).Width + 5) * 10 + 3 Me.Height = Picture1.Height + 900 Me.With = Picture1.Width + 80 Label1(0).Visible = False For n = 1 To 100 i = (n - 1) \ 10: j = (n - 1) Mod 10: Load Label1(n) With Label1(n) .Left = 5 + j * Label1(0).Width .Top = 5 + i * Label1(0).Height .Visible = True .Caption = n End With Next End Sub 我也不知道那里有错就是过不去。请帮我看看 |
地主 发表时间: 04-03-03 08:25 |
![]() | 回复: kert_t8 [kert_t8] ![]() |
登录 |
基本上没什么大问题 程序如下: Private Sub Command1_Click() Label1(1).Visible = False n = 100 For i = 2 To Sqr(n) If Label1(i).Visible = True Then MsgBox "现在开始删去" & Str(i) & "的倍的数", vbInformation, "用<筛法>找素数" For j = i + 1 To n If Label1(j).Visible = True And j Mod i = 0 Then Label1(j).Visible = False End If Next End If Next MsgBox "剩下来的整数已全都是素数!", vbInformation, "用<筛法>找素数" End Sub Private Sub Command2_Click() For n = 1 To 100 Label1(n).Visible = True Next End Sub Private Sub Form_Load() Picture1.Move 0, 0 Picture1.Height = (Label1(0).Height + 5) * 10 + 3 Picture1.Width = (Label1(0).Width + 5) * 10 + 3 Me.Height = Picture1.Height + 900 Me.Width = Picture1.Width + 80 Label1(0).Visible = False For n = 1 To 100 i = (n - 1) \ 10: j = (n - 1) Mod 10 '''': Load Label1(n)!!!!!! With Label1(n) .Left = 5 + j * Label1(0).Width .Top = 5 + i * Label1(0).Height .Visible = True .Caption = n End With Next End Sub 第一个是不需要使用load label1(n) 第二个,在command2_click这段代码中,应该用label1(n),而不应该用label(n) 基本上就是这样了 编译器再报错的时候你可以通过点"调试"来察看错误出在哪一行,知道出错在哪儿了就好办了,否则的话就是大海捞针 |
B1层 发表时间: 04-03-04 10:53 |
![]() | 回复: kert_t8 [kert_t8] ![]() |
登录 |
这个创意很好啊,搞教学用最合适,不介意的话我拿去到处给同学看哈:/D |
B2层 发表时间: 04-03-04 11:05 |
|
20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon
粤ICP备05087286号