المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : أرجو المساعدة


Hesham
04 - 08 - 2009, 00:25
]السلام عليكم ورحمة الله وبركاته[/SIZE]
أرجو المساعدة
أريد ان أكتب أمراً في Vb.net لأستطيع أن أنسخ ملف من علي الكمبيوتر إلي أي مكان

Mazin
05 - 08 - 2009, 00:30
هذي طريقة نسخ ملف

dim filetocopy as string
dim newcopy as string

filetocopy = "c:\test.txt"
newcopy = "c:\newtest.txt"

if system.io.file.exists(filetocopy) = true then
system.io.file.copy(filetocopy, newcopy)
msgbox("file copied")
end if


وهذي طريقة نقل ملف
بس اكيد يعتمد على اسم الملف لأنه يحتاج تعديل في الكود و filetomove و movelocation يحتاجلها Dim في البداية



filetomove = "c:\test.txt"
movelocation = "c:\ testfolder\test.txt"

if system.io.file.exists(filetomove) = true then
system.io.file.move(filetomove, movelocation)
msgbox("file moved")
end if

CS.Student
05 - 08 - 2009, 01:12
good work Mazin
:ay:

Hesham
06 - 08 - 2009, 00:27
شـكــ وبارك الله فيك ـــرا لك . جار التنفيذ

Hesham
04 - 02 - 2012, 18:04
بعد ما أصبحت أفهم شوي ها هو كود أخر

لنسخ الملف بدون إظهار أي رسائل (إلا إذا كان هناك خطأ)

My.Computer.FileSystem.CopyFile("C:\File.txt", "D:\File.txt")

لنسخ الملف بدون إستثناءات + طريقة نسخ الويندوز (إظهار مربع حوار النسخ)

My.Computer.FileSystem.CopyFile("C:\file.txt", "D:\file.txt", FileIO.UIOption.AllDialogs, FileIO.UICancelOption.DoNothing)