Nov 22, 2009
Pages: 1, 2

VB.NET: Howto Add And Delete Files - Just looking for useful code

free web hosting
Open Discussion & Free Web Hosting > Computers & Tech > Programming > Programming General > BASIC / Visual Basic (.NET)

VB.NET: Howto Add And Delete Files - Just looking for useful code

(G)guest-David_in_So_FL
FileSystem.Kill vs. File.Delete
VB.NET: Howto Add And Delete Files

Way to go Alex3410!  That saved me a lot of time.  I had trouble getting a file to go away.  If you use File.Delete(fname) you must make sure another process is not using it.  Otherwise you can use FileSystem.Kill(fname) which will just go ahead and delete the file.

David


Comment/Reply (w/o sign-up)

tansqrx
I didn’t realize that there is a kill function for files. I see that this is a carryover from VB6 and is generally frowned upon in .NET (http://msdn.microsoft.com/en-us/library/microsoft.visualbasic.filesystem.kill.aspx). The MSDN article also states that the kill functions requires Read and PathDiscovery flags of FileIOPermissions.

For better understandable code I would still use the System.IO.FileInfo methods discussed earlier.

Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Pages: 1, 2
Similar Topics

Keywords : vb, net, howto, add, delete, files, code

  1. Delete A Registry Subkey And Key
    Using Visual Basic 2005 Express (8)
  2. VB6 - Previewing BB Code...
    (5)
    I'm using Visual Basic 6 and want to know how (if possible) to create a program to preview BB
    code. Like the codes here using InvisionBoard with the " " tag for bold as an example. I want my
    program to allow the user to enter BB code and convert them to formatted text. Is this possible?
    Thanks.....
  3. How Do I Write Code Using WinSock Under .NET ?
    (4)
    I used to use the WinSock control in the traditional VB6 to make connections between computers. But
    now, I've moved to VB.NET and I want to know how can I do the same thing in .NET. Is there any
    .NET class that have the same function as WinSock 2? Please help me, I may need some example on how
    to use that class (code in VB.NET, please).....
  4. VS.NET: Editing Designer Generated Code Problem
    Old Problem - any workarounds ? (1)
    HI,     This is a very old & well-known bug in Visual Studio 2003 and I hear it's been recitifed
    in the 2005 version. But till I get my hands on it (which isn't hapenning soon enough) I still
    got to use the old VS2003. The problem is: if you mess around with the code that lies in the region
    "Windows Forms Designer Generated Code" - the form controls just VANISH when you load it up in
    designer mode. They just won't come back however hard you try - and all you're left with is
    a BLANK form. Not that it hampers with your code from running in any way - but y....

    1. Looking for vb, net, howto, add, delete, files, code

See Also,

*SIMILAR VIDEOS*
Searching Video's for vb, net, howto, add, delete, files, code
advertisement



VB.NET: Howto Add And Delete Files - Just looking for useful code

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com