Results 1 to 5 of 5

Thread: Delete a File? [Resolved]

  1. #1

    Thread Starter
    Member JesusFreak's Avatar
    Join Date
    Feb 2003
    Location
    Headed for Heaven
    Posts
    57

    Question Delete a File? [Resolved]

    How do you delete files in VB.NET?
    Last edited by JesusFreak; May 2nd, 2003 at 09:43 AM.
    That if you confess with your mouth, "Jesus is Lord," and believe in your heart that God raised him from the dead, you will be saved.

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    VB Code:
    1. IO.File.Delete("c:\myfile.exe")

    There is a ton of good stuff in the IO namespace. The Path object also has some helpful functions.

  3. #3
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Make sure that you wrap your file io operations in a try-catch block so your app doesn't crash when something unexpected happens.

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    At least make sure it exists:
    VB Code:
    1. If IO.File.Exists("c:\myfile.exe") Then
    2.      IO.File.Delete("c:\myfile.exe")
    3. End If

  5. #5

    Thread Starter
    Member JesusFreak's Avatar
    Join Date
    Feb 2003
    Location
    Headed for Heaven
    Posts
    57
    Thanks for the help everyone!
    That if you confess with your mouth, "Jesus is Lord," and believe in your heart that God raised him from the dead, you will be saved.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width