Hi,
Using Basic4PPC
Got a problem using frm.DrawImage locking the files so I can't manipulate them later. Here's a summarized version of the code process (taken from various different parts of the project):
Now if I comment out the 'frmScan.DrawImage(selectedImage,220,530,365,645)' then all is well.
As soon as I put it in, it gives the error (at the Filesex1.FileRename line):
"The process cannot access the file because it is being used by another process"
I put the frmScan.Image = "" line in to clear the image on the form, but I guess the system still looks at the image file anyway.
Am I clearing the image from the form properly? Is there away to stop the file being locked when I need to rename it?
Many thanks in advance!
Using Basic4PPC
Got a problem using frm.DrawImage locking the files so I can't manipulate them later. Here's a summarized version of the code process (taken from various different parts of the project):
B4X:
latestFile = fileList.Item(i) 'Taken from FOR loop elsewhere
selectedImage = latestFile 'assign local var to global var
frmScan.DrawImage(selectedImage,220,530,365,645) 'Draws preview on form
'Different sub now
frmScan.Image = ""
If StrLength(selectedImage) > 0 Then
Filesex1.FileRename(selectedImage,scan & ".jpg") 'FilesEx created & used elsewhere
End If
Now if I comment out the 'frmScan.DrawImage(selectedImage,220,530,365,645)' then all is well.
As soon as I put it in, it gives the error (at the Filesex1.FileRename line):
"The process cannot access the file because it is being used by another process"
I put the frmScan.Image = "" line in to clear the image on the form, but I guess the system still looks at the image file anyway.
Am I clearing the image from the form properly? Is there away to stop the file being locked when I need to rename it?
Many thanks in advance!