Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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...

  • *Experts*
Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...