一个关于用vb实现两组数据循环相乘并print的问题…

2024-11-30 04:20:44
推荐回答(1个)
回答1:

添加一个Text控件,将Text1控件的MultiLine属性(多行)设置成True,ScrollBars属性(滑动条)设置成2-Vertical(竖直滑动条)。
具体代码如下 :

Private Sub Form_Load()
Dim a(1 To 3) As Integer
Dim b(1 To 4) As Integer
a(1) = 7
a(2) = 3
a(3) = 4
b(1) = 8
b(2) = 9
b(3) = 7
b(4) = 6
Text1.Text = ""
For i = 1 To 3
For j = 1 To 4
If a(i) * b(j) > 15 Then
Text1.Text = Text1.Text & a(i) & "*" & b(j) & "=" & a(i) * b(j) & ">" & "15" & Chr(13) & Chr(10)
End If
Next j
Next i

End Sub

运算结果:
7*8=56>15
7*9=63>15
7*7=49>15
7*6=42>15
3*8=24>15
3*9=27>15
3*7=21>15
3*6=18>15
4*8=32>15
4*9=36>15
4*7=28>15
4*6=24>15