السلام عليكم
تضهر لدي مشكلة عندما اريد حذف صورة من يتم عرضها داخل الكنترول PictueBox من مسار داخل المشروع
الكود
'عرض الصورة
Private Sub btnShow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShow.Click
Dim pic As New Bitmap(Application.StartupPath & "\Follow.jpg")
PictureBox1.Image = pic
End Sub
'حذف الصورة
Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click
Dim StrPath As String = Application.StartupPath & "\Follow.jpg"
Dim f As New System.IO.FileInfo(StrPath)
f.Delete()
End Subرسالة الخطأ :-
The process cannot access the file 'Follow.jpg' because it is being used by another process.