hercemer Posted April 24, 2003 Posted April 24, 2003 I hope I am posting this in the right place. I am making a PictureBox that shows a file called 'lookoout.jpg' The 'lookout.jpg' is generated by a motion camera (everytime there is motion). What I would like, is for the PictureBox to Display Lookout.JPG, and then delete the 'lookout.jpg' (and then display it again while the other image is still showing). Form2 just has a picture box on it, with a close button. ------------------------------------------- Dim form2settings As New Form2() form2settings.Show() ------------------------------------------- Close Button - ------------------------------------------- System.IO.File.Delete("lookout.jpg") -------------------------------------------- Proble: lookoout.jpg is in use by the PictureBox, and cannot be deleted. Is there a way to load the picture into memory so I can delete the original file? Thanks in advance!! Quote
*Experts* Nerseus Posted April 24, 2003 *Experts* Posted April 24, 2003 Try this: Dim b As Bitmap = New Bitmap("lookout.jpg") Dim newBitmap As Bitmap = b.Clone(); PictureBox1.Picture = newBitmap I haven't tested this... :) -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
hercemer Posted April 24, 2003 Author Posted April 24, 2003 Looks VERY promising!!! I will give it a shot and let you know (will be sometime tonight). Thanks!!! Quote
hercemer Posted April 25, 2003 Author Posted April 25, 2003 I tried: ------------------------------------------------------------------------ Dim b As Bitmap = New Bitmap("lookout.jpg") Dim newBitmap As Bitmap = b.Clone() b.Dispose() PictureBox1.Image = newBitmap ------------------------------------------------------------------------ But file is still in use when picture is displayed. Thanks for the idea tho' Quote
aewarnick Posted April 27, 2003 Posted April 27, 2003 Maybe you could put it in the clipboard. Clipboard.SetDataObject() Quote C#
Hamburger1984 Posted June 12, 2003 Posted June 12, 2003 I'm a member of the vbCity.com Forums and somebody had the same problem there - I found a solution - here is the post: http://www.devcity.net/forums/topic.asp?tid=30286 hope that helps! 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.