How to Remove and Delete text from Text File

  • '========== Delete TextFile=========='

    Dim FileToDelete As String

    FileToDelete = "D:\Sessions.txt"

    If System.IO.File.Exists(FileToDelete) = True Then


    MsgBox("File Deleted")

    End If

    '========= Remove all text from textfile=========

    'Dim lines As New List(Of String)(IO.File.ReadAllLines("D:\Sessions.txt"))
    ' lines.RemoveAt(0)

    'lines.RemoveRange(0, lines.Count)

    ' IO.File.WriteAllLines("D:\Sessions.txt", lines.ToArray())

Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Popular Posts of the Week