I have an application that displays an image in the viewer control for the user to inspect, and then after making some keystrokes, the image is intended to be renamed.
The problem is that often / most of the time the rename function fails, an IOException thrown because the source file is in use.
I have tried:
- Dispose the image [viewer.Images.Item(0).Dispose()]
- Dispose of the whole thing [viewer.Images.ClearAndDisposeItems()[
- Both of the above
- All of the above with a forced GC.Collect / GC.WaitForPendingFinalizers
- All of that, plus some misc. sleep commands
- All of that, plus viewer.Dispose.
Any ideas? This is a real potential problem - how do I really, totally, completely close an image and be sure that I can access that file consistently?
access issue (file is in use)
Moderator: Alex
Re: access issue (file is in use)
Hello,
Please send the demo application which demonstrates your problem to support@vintasoft.com.
Best regards, Alexander
Please send the demo application which demonstrates your problem to support@vintasoft.com.
Best regards, Alexander
Re: access issue (file is in use)
Hello!
I have the same Problem.
I have an WinForm with one Thumbnailviewer and one Imageviewer. I show thumbs left side and the user can choose each picture to see it right in the imageviewer.
I added an contectMenu to the Thumbnailviewer with the "delete" option. Always i use delete i get the io exception with "file is in use"....
Where is my error?
Best regards,
Christian
Private Sub delete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles löschen.Click
Dim DateiName As String = ThumbnailViewer1.FocusedImage.SourceInfo.Filename
ThumbnailViewer1.Images.RemoveAt(ThumbnailViewer1.FocusedIndex)
If ImageViewer1.Images.Count > 0 Then
ImageViewer1.Images.ClearAndDisposeItems()
End If
ImageViewer1.ThumbnailViewer = Nothing
ThumbnailViewer1.Images.ClearAndDisposeItems()
ThumbnailViewer1.Refresh()
ThumbnailViewer1.Update()
If File.Exists(DateiName) Then
Try
File.Delete(DateiName)
Catch ex As Exception
MsgBox("Das Bild " & DateiName & " konnte nicht gelöscht werden!" & vbNewLine & ex.ToString, MsgBoxStyle.Critical)
End Try
End If
ImageViewer1.ThumbnailViewer = ThumbnailViewer1
Call Thumbs_ReNew()
End Sub
I have the same Problem.
I have an WinForm with one Thumbnailviewer and one Imageviewer. I show thumbs left side and the user can choose each picture to see it right in the imageviewer.
I added an contectMenu to the Thumbnailviewer with the "delete" option. Always i use delete i get the io exception with "file is in use"....
Where is my error?
Best regards,
Christian
Private Sub delete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles löschen.Click
Dim DateiName As String = ThumbnailViewer1.FocusedImage.SourceInfo.Filename
ThumbnailViewer1.Images.RemoveAt(ThumbnailViewer1.FocusedIndex)
If ImageViewer1.Images.Count > 0 Then
ImageViewer1.Images.ClearAndDisposeItems()
End If
ImageViewer1.ThumbnailViewer = Nothing
ThumbnailViewer1.Images.ClearAndDisposeItems()
ThumbnailViewer1.Refresh()
ThumbnailViewer1.Update()
If File.Exists(DateiName) Then
Try
File.Delete(DateiName)
Catch ex As Exception
MsgBox("Das Bild " & DateiName & " konnte nicht gelöscht werden!" & vbNewLine & ex.ToString, MsgBoxStyle.Critical)
End Try
End If
ImageViewer1.ThumbnailViewer = ThumbnailViewer1
Call Thumbs_ReNew()
End Sub
Re: access issue (file is in use)
Hello,
Thank you for your messages. We have fixed the bug in version 4.3.5.1 of VintaSoftImaging.NET SDK.
Best regards, Alexander
Thank you for your messages. We have fixed the bug in version 4.3.5.1 of VintaSoftImaging.NET SDK.
Best regards, Alexander