关于一段vb的程序,请大神帮我修改下,在command2中,我想让(一)(二)同时运行应该怎么办?
Dima(0To89)AsInteger,b(90)AsInteger,c(90)AsIntegerPrivateSubCommand1_Click()ShowPrint...
Dim a(0 To 89) As Integer, b(90) As Integer, c(90) As Integer
Private Sub Command1_Click()
Show
Print "90个随机整数:"
Randomize
For j = 0 To 89
a(j) = Int(90 * Rnd + 10)
If j Mod 15 = 0 Then Print
Print a(j);
Next j
End Sub
Private Sub Command2_Click()
(一)
i = 0
For j = 0 To 89
If a(j) Mod 2 = 0 Then
i = i + 1
b(i) = a(j)
Picture1.Print b(i);
If i Mod 15 = 0 Then Picture1.Print
End If
Next j
End Sub
(二)
o = 0
For j = 0 To 89
If a(j) Mod 2 = 0 Then
o = o + 1
c(o) = a(j)
Picture1.Print c(o);
If o Mod 15 = 0 Then Picture2.Print
End If
Next j
End Sub 展开
Private Sub Command1_Click()
Show
Print "90个随机整数:"
Randomize
For j = 0 To 89
a(j) = Int(90 * Rnd + 10)
If j Mod 15 = 0 Then Print
Print a(j);
Next j
End Sub
Private Sub Command2_Click()
(一)
i = 0
For j = 0 To 89
If a(j) Mod 2 = 0 Then
i = i + 1
b(i) = a(j)
Picture1.Print b(i);
If i Mod 15 = 0 Then Picture1.Print
End If
Next j
End Sub
(二)
o = 0
For j = 0 To 89
If a(j) Mod 2 = 0 Then
o = o + 1
c(o) = a(j)
Picture1.Print c(o);
If o Mod 15 = 0 Then Picture2.Print
End If
Next j
End Sub 展开
1个回答
展开全部
去掉中间的End Sub就可以了,就是不知道为什么要这么干,看起来应该直接把b(i) print 2次不就行了?为什么要重新计算C之后再打印?而且"If o Mod 15 = 0 Then Picture2.Print ”这里为什么是Picture2?或者说前面一名为什么是Picture1?
如果说你要是想同时在两个Picture中显示的话,可以采用Timer控件,将两段代码放在timer事件中并在末尾加上timer.enable=0
如果说你要是想同时在两个Picture中显示的话,可以采用Timer控件,将两段代码放在timer事件中并在末尾加上timer.enable=0
追问
哦,好的,其实是我看错了,把第二个都改成picture2就对了
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询