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
展开
 我来答
网海1书生
科技发烧友

推荐于2018-04-18 · 擅长软件设计、WEB应用开发、小程序
网海1书生
采纳数:12311 获赞数:26228

向TA提问 私信TA
展开全部
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才有换行效果

红山人2008
2015-07-02 · TA获得超过4679个赞
知道大有可为答主
回答量:5699
采纳率:0%
帮助的人:3936万
展开全部
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
'Print "共有以上"; L; "组。"
Text1 = Text1 + vbCrLf + "共有以上" + Str(L) + "组。"
End Sub
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式