Open App.Path & "\out5.txt" For Output As #1
print #1, text1.text
Close #1用上面的方法只能在第一行输入 如何在第二行输入呢,如果方便的话也请告诉我如何调用第二行的值?

解决方案 »

  1.   

    改下~~~~~~~~~~~Open App.Path & "\out5.txt" For Append As #1
      

  2.   

    Open App.Path & "\out5.txt" For Output As #1
    print #1,""            '''''''''''空一行應該就可以了吧,難道是我沒理解題目意思?
    print #1, text1.text
    Close #1
      

  3.   

    帮你找到一个获取文本行数的函数
    如果要再任意行插入估计还要利用到其他API函数了!
    Const WM_USER = &H400
    Const EM_GETLINECOUNT = WM_USER + 10#If Win32 ThenPrivate Declare Function SendMessage Lib "user32" _
        Alias "SendMessageA" _
        (ByVal hWnd As Long, _
        ByVal wMsg As Long, _
        ByVal wParam As Integer, _
        lParam As Any) As Long
    #ElsePrivate Declare Function SendMessage Lib "user" _
        (ByVal hWnd As Integer, _
        ByVal wMsg As Integer, _
        ByVal wParam As Integer, _
        lParam As Any) As Long
    #End IfFunction TextLineCount(txtObj As TextBox) As Long
        If txtObj.MultiLine = True Then
            TextLineCount = SendMessage(txtObj.hWnd, EM_GETLINECOUNT, 0, 0&)
        Else
            TextLineCount = 1
        End If
    End Function
      

  4.   

    chanfengsr(巉沨散人) ( ) 信誉:100    Blog 你的方法最后如何调用呢?
      

  5.   

    如果out5.txt是已存在的文件,用output就会把第一行覆盖!
    用append则只能在最后添加
    对于顺序文件,我看你只能读出文件所有内容,然后修改第二行(你想改的行数),再写入
      

  6.   

    用append则只能在最后添加 这个方法也可以!  谁告诉我一下方法