下面这段代码不能实现换行,为什么?
Private Sub Command1_Click()
    Dim strTmp As String
    Open "E:tmp.txt" For Input As #1
    While Not EOF(1)
        Line Input #1, strTmp
        Text1.Text = Text1.Text & chr(13) & chr(10)
    Wend
End Sub

解决方案 »

  1.   

    Private Sub Command1_Click()
        Dim strTmp As String
        Open "E:tmp.txt" For Input As #1
        While Not EOF(1)
            Line Input #1, strTmp
            Text1.Text = Text1.Text & vbcrlf
        Wend
    End Sub
      

  2.   

    to 楼主:你的代码应该没有什么问题
    你需要设置text1的MultiLine属性为true
      

  3.   

    如楼上所说,把text1的MultiLine属性设为true
    再把你的代码加上你所定义的变量strTmp。
    Private Sub Command1_Click()
        Dim strTmp As String
        Open "E:tmp.txt" For Input As #1
        While Not EOF(1)
            Line Input #1, strTmp
            Text1.Text = Text1.Text & strTmp & chr(13) & chr(10)
        Wend
    End Sub
      

  4.   


    想请教一下,chr(13) & chr(10)与& vbcrlf有什么区别,谢谢
      

  5.   

    //想请教一下,chr(13) & chr(10)与& vbcrlf有什么区别,谢谢2者是等价的
      

  6.   

    没有区别,chr(13)就是vbcr,chr(10)就是vblf,加一块就是vbcrlf
      

  7.   

    最后总结
    如楼上所说,把text1的MultiLine属性设为truePrivate Sub Command1_Click()
        Dim strTmp As String
        
        Open "E:tmp.txt" For Input As #1
        text1.text=""
        While Not EOF(1)
            Line Input #1, strTmp
            Text1.Text = Text1.Text & strTemp & chr(13) & chr(10)
        Wend
        close #1
    End Sub