(05-01-19, 10:59 AM)mmali127 كتب : السلام عليكم ورحمه الله وبركاته
تحية للاعضاء الكرام
اولا : - الكود التالى خاص بحذف الصورة من مسار البرنامج
PbPic.Image.Dispose()
Dim FileDelete As String = (Application.StartupPath & "\Mypicture\" & txtItemID.Text & ".jpg")
If System.IO.File.Exists(FileDelete) Then
System.IO.File.Delete(FileDelete)
End If
حيث ان
(1) PbPic هو اسم PictureBox
(2) Mypicture هو اسم مجلد الصور فى مسار البرنامج
(3) txtItemID هو اسم التكست بوكس لاسم الصورة فى النموذج المستخدم
(4) PbPic.Image.Dispose هو اجراء لتفريغ ال PictureBox
___________________________________________________________________________________________________________________
ثانيا : - الكود التالى خاص باضافة الصورة الجديدة المعدلة للصنف بنفس مسار الصور
Dim MYPicPhath As String
IO.File.Copy(MYPicPhath, Application.StartupPath & "\Mypicture\" & txtItemID.Text & ".jpg")
MYPicPhath = Application.StartupPath & "\Mypicture\" & txtItemID.Text & ".jpg"
txtMyPicPath.Text = MYPicPhath
ان شاء الله يمشى معاك الحال
تحياتى
شكرا لردك الكود الثاني مافائدته اين اضعه اشكرك جزيل الشكر
بعد التجربة بهذا الكود ضهر لي نفس الرسالة
كود :
PictureBox1.Image.Dispose()
Dim FileDelete As String = Application.StartupPath & "\image\" & Pectcher.Text
If System.IO.File.Exists(FileDelete) Then
System.IO.File.Delete(FileDelete)
cls.clairemploiter()هذه الرسالة
Le processus ne peut pas accéder au fichier 'C:\Users\xp\Documents\blp\blp\bin\Debug\image\cart-biblio.jpg', car il est en cours d'utilisation par un autre processus
