I've solve this issue by using the MemoryStream. Now i m giving the Byte[] as input to the MemoryStream and then i used this memory stream to load the pic into the pic Box.
--- In [email protected], "Shahid Riaz Bhatti" <[EMAIL PROTECTED]> wrote: > > Hi > i m loading the pic into a pic box from the db. It works fine and it > makes a file name of that pic with the name of the employee code. e.g. > i double click on a employee record with the employee code "xyz". It > open a window with the info relating to that employee and loads its pic > into the pic box and make a file of the image with the name 'xyz'. > Now i closed the window and open the same employee record and it gives > me an error "THe process could not access the file, because it is being > used by another process." > To load the pic i m using this : > > FileStream fs=new FileStream("Images\\" + > strfnn,FileMode.OpenOrCreate); > fs.Write(barrImg,0,barrImg.Length); > fs.Flush(); > fs.Close(); > picEmp.Image=Image.FromFile("Images\\" + strfnn); > > I have also used the FileMode.Create but it also gives the same error. > Any idea how to solve it. > Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/Microsofts_C_Sharp/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
