欢迎光临:
  
  非常感谢您光临枕善居。本站是一个免费的基于VB,VB.NET源代码交流的平台,为大家提供优质的专业的源代码,如果您有需要,本站可以帮助在业余时间里给您寻找代码。当然,如果您有好的代码也可以在本站发布,共享给大家。
专业VB和.NET源码、编程开发教程、图标资源、USB电脑遥控器、智能家电控制开关....更多东东请进入我的淘宝小店--->
VB及.NET新源码2011(3DVD,控件+资源) 智能多路控制(串口编程开关) 带源码!


06-04
13

删除任意文件的指定行

用法:
DeleteLineFromFile App.Path & "/test.txt", 3

函数:
Public Sub DeleteLineFromFile(RFile As String, RLine As Integer)
    Dim FileNum As Integer
    Dim TextLine As String
    Dim NewText As String
    Dim CurentLine As Integer
    FileNum = FreeFile
    Open RFile For Input As #FileNum


    Do Until EOF(FileNum)
        Line Input #FileNum, TextLine
        currentline = currentline + 1


        If Not currentline = RLine Then


            If currentline = 1 Then
                NewText = TextLine
            Else
                NewText = NewText & vbNewLine & TextLine
            End If
        End If
    Loop
    Close #FileNum
    Open RFile For Output As #FileNum
    Print #FileNum, NewText
    Close #FileNum
End Sub


相关日志:
文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags:
评论: 1 | 引用: 0 | 查看次数: 6000

回复回复wend [2006-04-13 19:09:48 |  | del]
好像只能删除指定的一行字符[surprised]
发表评论
您没有权限发表评论!