An unhandled exception of type 'System.OutOfMemoryException' occurred in System.Drawing.dll Additional information: Out of memory
You could try calling the following before assigning a new Bitmap to pictureBox1.Image
, to remove the previous "new" Bitmap and free up resources:
pictureBox1.Image.Dispose();