17-10-12, 06:18 PM
كاتب الموضوع : Boutemine Oualid
السلام عليكم و رحمة الله و بركاتهVB.NET
كود :
Dim UIOption As Microsoft.VisualBasic.FileIO.UIOption
Private Sub CopieFichier(ByVal FileSource As String, ByVal FileDestination As String)
If My.Computer.FileSystem.FileExists(FileSource) Then
My.Computer.FileSystem.CopyFile(FileSource, FileDestination, UIOption.OnlyErrorDialogs, FileIO.UICancelOption.ThrowException)
Else
MsgBox("Le fichier source n'existe pas")
End If
End Sub
كود :
public static void CopyFile(string srcFile, string destFile, bool overwrite)
{
if (File.Exists(srcFile)) File.Copy(srcFile, destFile, overwrite);
else throw new FileNotFoundException("File not found");
}