How to Copy , Delete File
The File Class is using the operations such as copying, moving, renaming, creating, opening, deleting, and appending to files.
File.Copy("c:\\temp.txt", "c:\\copytemp.txt", True) File.Delete("c:\\copytemp.txt")
IOException is the base class for exceptions thrown while accessing information using streams, files and directories. FileNotFoundException Class is thrown the exception when an attempt to access a file that does not exist on disk fails.
Try 'code here Catch ex As System.IO.FileNotFoundException 'exception here End Try
The following vb.net program shows how to use File Class for copying and deleting a text file and also its shows how to handle System.IO.FileNotFoundException Class.
- How to VB.NET Directory operations
- How to VB.NET File operations
- How to VB.NET FileStream
- How to VB.NET TextReader
- How to VB.NET Simple TextReader
- How to VB.NET TextWriter
- How to VB.NET BinaryReader
- How to VB.NET BinaryWriter
- How to convert xps file to bmp file
- How to VB.Net Path Class
- How to create PDF files in vb.net
- How to convert text file to pdf
- Write database to PDF file