منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب

نسخة كاملة : لنسخ الملفات
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
كاتب الموضوع : 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
c#

كود :
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");
}