Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. cannot forcefully delete a file

cannot forcefully delete a file

Scheduled Pinned Locked Moved Visual Basic
help
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ashu_sharma21
    wrote on last edited by
    #1

    Hi, i am trying to delete a file If csvFile.Exists(csvFilePath) Then csvFile.Delete(csvFilePath) End If its giving me error file used by another process do u have a code who delete file forcefully and close all process Please help! Thanks Ashu Sharma

    D A 2 Replies Last reply
    0
    • A ashu_sharma21

      Hi, i am trying to delete a file If csvFile.Exists(csvFilePath) Then csvFile.Delete(csvFilePath) End If its giving me error file used by another process do u have a code who delete file forcefully and close all process Please help! Thanks Ashu Sharma

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      If the file is open by another process, it's impossible to delete it. Closing all other processes is out of the question, since you have no idea which process has the file open. There is no method to determine which process has it either. Closing processes willy-nilly will only get your application uninstalled and the first available opportunity. It's just horrible programming practice. If your application has the file open, well, the solution is obvious... RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      1 Reply Last reply
      0
      • A ashu_sharma21

        Hi, i am trying to delete a file If csvFile.Exists(csvFilePath) Then csvFile.Delete(csvFilePath) End If its giving me error file used by another process do u have a code who delete file forcefully and close all process Please help! Thanks Ashu Sharma

        A Offline
        A Offline
        Ashaman
        wrote on last edited by
        #3

        To replace/delete files after rebooting you need to create a file named wininit.ini in the Windows directory Then enter the following for example: [Rename] c:\windows\system\myoldsys.dll=c:\mynewsys.dll to delete the file you would enter: NUL=c:\windows\system\myoldsys.dll So we see that the format is "newname=oldname" You need to use always the shortfilename for this to work longfilenames do not work at all.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups