Permission Denied When Writing Image To File Again
Posted: 2019-04-20T07:50:45-07:00
I'm writing images to a directory on my drive and I put each image I write into Image parameter of a CheckBox control using the code below...
Each checkbox is then added to a FlowLayoutPanel control.
Then when I select the CheckBox control that is in a FlowLayoutPanel control and resize the image and try to write it again with the new Width and Height using the same filetarget, I get a Permission Denied exception. The cause is the code above, because the CheckBox object with the Image somehow prevents the same file to be written again.
Does anyone know a fix for this?
Each checkbox is then added to a FlowLayoutPanel control.
Code: Select all
myCheckBox.Image = Image.FromFile(filetarget);
Does anyone know a fix for this?