Salat Posted April 2, 2003 Posted April 2, 2003 I'm useing such a code Dim BackGround as Image Dim ffi As Integer = FreeFile() Dim ImaPath As String = Application.StartupPath & "\EFImaSaveTmp.jpg" FileOpen(ffi, ImaPath, OpenMode.Binary, OpenAccess.Write, OpenShare.Shared) FilePut(ffi, stream) FileClose(ffi) BackGround = Image.FromFile(ImaPath) where stream is a whole image file structure (binaries) When I call this code once, everything is ok, but when I call it second time then this exception occurs at "FileOpen" line An unhandled exception of type 'System.IO.IOException' occurred in microsoft.visualbasic.dll Additional information: The process cannot access the file "d:\Moje dokumenty\PIOTREK\Visual Studio Projects\EasyForms\bin\EFImaSaveTmp1.jpg" because it is being used by another process. What is wrong? this file is closed... Quote profesjonalne programowanie na zlecenie :)
Salat Posted April 3, 2003 Author Posted April 3, 2003 shell I use IO.BinaryWriter? Quote profesjonalne programowanie na zlecenie :)
*Experts* Volte Posted April 3, 2003 *Experts* Posted April 3, 2003 Yes, you should use BinaryWriter. The FileOpen, etc. commands are only for backward compatability and should be avoided. There's lots of info the in MSDN about it. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.