vb如何将“Print”的内容改到文本框text1中显示
PrivateSubCommand1_Click()DimA1AsString,A2AsStringDimA1lAsInteger,A2lAsIntegerDimIAsI...
Private Sub Command1_Click()
Dim A1 As String, A2 As String
Dim A1l As Integer, A2l As Integer
Dim I As Integer, J As Integer, K As Integer, L As Integer
Dim B() As String, Bl As Integer
Dim C() As String, Cl As Integer
A1 = InputBox("第一组数", "输入", "12345")
A2 = InputBox("第二组数", "输入", "06789")
A1l = Len(A1)
A2l = Len(A2)
I = A1l * (A1l - 1) / 2
ReDim B(I)
I = I * A2l
ReDim C(I)
For I = 1 To A1l - 1
For J = I + 1 To A1l
K = K + 1
B(K) = Mid(A1, I, 1) & Mid(A1, J, 1)
Next
Next
For I = 1 To A2l
For J = 1 To K
L = L + 1
C(L) = Mid(A2, I, 1) & B(J)
Print C(L); Space(1);
If L Mod 10 = 0 Then Print
Next
Next
Print
Print "共有以上"; L; "组。"
End Sub 展开
Dim A1 As String, A2 As String
Dim A1l As Integer, A2l As Integer
Dim I As Integer, J As Integer, K As Integer, L As Integer
Dim B() As String, Bl As Integer
Dim C() As String, Cl As Integer
A1 = InputBox("第一组数", "输入", "12345")
A2 = InputBox("第二组数", "输入", "06789")
A1l = Len(A1)
A2l = Len(A2)
I = A1l * (A1l - 1) / 2
ReDim B(I)
I = I * A2l
ReDim C(I)
For I = 1 To A1l - 1
For J = I + 1 To A1l
K = K + 1
B(K) = Mid(A1, I, 1) & Mid(A1, J, 1)
Next
Next
For I = 1 To A2l
For J = 1 To K
L = L + 1
C(L) = Mid(A2, I, 1) & B(J)
Print C(L); Space(1);
If L Mod 10 = 0 Then Print
Next
Next
Print "共有以上"; L; "组。"
End Sub 展开
2个回答
展开全部
Private Sub Command1_Click()
Dim A1 As String, A2 As String
Dim A1l As Integer, A2l As Integer
Dim I As Integer, J As Integer, K As Integer, L As Integer
Dim B() As String, Bl As Integer
Dim C() As String, Cl As Integer
A1 = InputBox("第一组数", "输入", "12345")
A2 = InputBox("第二组数", "输入", "06789")
A1l = Len(A1)
A2l = Len(A2)
I = A1l * (A1l - 1) / 2
ReDim B(I)
I = I * A2l
ReDim C(I)
For I = 1 To A1l - 1
For J = I + 1 To A1l
K = K + 1
B(K) = Mid(A1, I, 1) & Mid(A1, J, 1)
Next
Next
For I = 1 To A2l
For J = 1 To K
L = L + 1
C(L) = Mid(A2, I, 1) & B(J)
Text1.Text = Text1.Text & C(L) & " " '!!!!
If L Mod 10 = 0 Then Text1.Text = Text1.Text & vbCrLf '!!!!
Next
Next
Text1.Text = Text1.Text & vbCrLf '!!!!
Text1.Text = Text1.Text & "共有以上" & L & "组。" '!!!!
End Sub
标有!!!!的行就是修改过的
注:Text1的MulitLine属性必须设为True才有换行效果
展开全部
text1= "共有以上" & L & "组。"
追问
试过了不行,text1要显示“print所显示全部内容”才行啊
追答
'先要在属性窗口里把text1的multiline属性设为true,朋友。这很重要。呵呵
Private Sub Command1_Click()
Text1 = ""
Dim A1 As String, A2 As String
Dim A1l As Integer, A2l As Integer
Dim I As Integer, J As Integer, K As Integer, L As Integer
Dim B() As String, Bl As Integer
Dim C() As String, Cl As Integer
A1 = InputBox("第一组数", "输入", "12345")
A2 = InputBox("第二组数", "输入", "06789")
A1l = Len(A1)
A2l = Len(A2)
I = A1l * (A1l - 1) / 2
ReDim B(I)
I = I * A2l
ReDim C(I)
For I = 1 To A1l - 1
For J = I + 1 To A1l
K = K + 1
B(K) = Mid(A1, I, 1) & Mid(A1, J, 1)
Next
Next
For I = 1 To A2l
For J = 1 To K
L = L + 1
C(L) = Mid(A2, I, 1) & B(J)
' Print C(L); Space(1);
Text1 = Text1 & C(L) & " "
If L Mod 10 = 0 Then Text1 = Text1 + vbCrLf
Next
Next
'Print "共有以上"; L; "组。"
Text1 = Text1 + vbCrLf + "共有以上" + Str(L) + "组。"
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询