VB怎么将这些输出的答案不直接print而是出现在Label和List中。求代码啊。求高手帮忙改一下。
一个出现在Label一个出现在List中PrivateSubCommand2_Click()'三角型Fori=1To9Fori1=1ToiPrinti1&"";NextP...
一个出现在Label
一个出现在List中
Private Sub Command2_Click() '三角型For i = 1 To 9 For i1 = 1 To i Print i1 & " "; Next Print NextEnd SubPrivate Sub Command3_Click() '乘法表 Dim k As String * 7 For i = 1 To 9 For i1 = 1 To i k = i1 & "×" & i & "=" & i1 * i Print k; Next Print NextEnd Sub 展开
一个出现在List中
Private Sub Command2_Click() '三角型For i = 1 To 9 For i1 = 1 To i Print i1 & " "; Next Print NextEnd SubPrivate Sub Command3_Click() '乘法表 Dim k As String * 7 For i = 1 To 9 For i1 = 1 To i k = i1 & "×" & i & "=" & i1 * i Print k; Next Print NextEnd Sub 展开
2个回答
展开全部
第一个:
Private Sub Form_Click() '三角型
Dim str As String
For i = 1 To 9
For i1 = 1 To i
str = str & i1 & " "
Next
str = str & vbCrLf
Next
Label1.Caption = str
End Sub
第二个:
Private Sub Form_Click() '乘法表
Dim str As String
Dim k As String * 7
For i = 1 To 9
For i1 = 1 To i
k = i1 & "×" & i & "=" & i1 * i
str = str & " " & k
Next
List1.AddItem (Trim(str))
str = ""
Next
End Sub
展开全部
'三角型
Dim s As String
s = ""
For i = 1 To 9
For i1 = 1 To i
'Print i1 & " ";
s = s & i1 & " "
Next
s = s & vbCrLf
Next
Label1.Caption = s
'乘法表
Dim s As String
Dim k As String * 7
For i = 1 To 9
s = ""
For i1 = 1 To i
s = s & i1 & "×" & i & "=" & i1 * i & " "
Next
List1.AddItem s
Next
Dim s As String
s = ""
For i = 1 To 9
For i1 = 1 To i
'Print i1 & " ";
s = s & i1 & " "
Next
s = s & vbCrLf
Next
Label1.Caption = s
'乘法表
Dim s As String
Dim k As String * 7
For i = 1 To 9
s = ""
For i1 = 1 To i
s = s & i1 & "×" & i & "=" & i1 * i & " "
Next
List1.AddItem s
Next
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询