Hi guys,
i have a picturebox on my program that will load a picture from file every 10 seconds (C:\Picture1.png), i have another program capturing a picture and saving it to the same location, my first app captures fine and saves it, and the second program loads the picture but when the first program tries to overwrite the picture file it says it is being used by another process, with the code below:
i tried disposing of the bmp once i had loaded it into the picturebox with:
but this just makes the picturebox display a white box with a red cross (diagonal) inside it.
Is there a way to load a bitmap into a picturebox and then release the file??
Thanks
Stu
i have a picturebox on my program that will load a picture from file every 10 seconds (C:\Picture1.png), i have another program capturing a picture and saving it to the same location, my first app captures fine and saves it, and the second program loads the picture but when the first program tries to overwrite the picture file it says it is being used by another process, with the code below:
VB.NET:
[COLOR=blue]If[/COLOR] [COLOR=#2B91AF]File[/COLOR].Exists(fName) [COLOR=blue]Then[/COLOR]
[COLOR=blue]Dim[/COLOR] bmp [COLOR=blue]As[/COLOR] [COLOR=blue]New[/COLOR] [COLOR=#2B91AF]Bitmap[/COLOR](fName)
R1_3.Image = bmp
[COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
i tried disposing of the bmp once i had loaded it into the picturebox with:
VB.NET:
[COLOR=blue]If[/COLOR] [COLOR=#2B91AF]File[/COLOR].Exists(fName) [COLOR=blue]Then[/COLOR]
[COLOR=blue]Dim[/COLOR] bmp [COLOR=blue]As[/COLOR] [COLOR=blue]New[/COLOR] [COLOR=#2B91AF]Bitmap[/COLOR](fName)
R1_3.Image = bmp
bmp.Dispose()
[COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
but this just makes the picturebox display a white box with a red cross (diagonal) inside it.
Is there a way to load a bitmap into a picturebox and then release the file??
Thanks
Stu