GDI+ Generic Error work around.
Use this board to post your code snippets - tips and tricks
1 post
Page 1 of 1
if you ever are working with images ans keep receiving a error message like this
and you just cant google a answer.
this is what you can do.
if you use a button to run the code
Set it for 3 to 5 seconds 3000/5000
Timer.Interval = 3000 to 5000
Timer.Enabled = True
Timer.Start()
Now in the Timer_Tick Event simple re-enable the button and turn the timer off
All this does is disables the Button or whatever control until the GDI+ has finished what it is doing in the background.
normally a few seconds depending on the size of the image. but a minimum of 3 seconds is a good start.
And another piece or advise. on GDI+
If you are working on a Image and you keep getting the Access Denied error message.
This is because the Image is "Open or being used". You need to .Close() or .Dispose() of the image first
then you can continue work work on it.
Believe it or not, this error is really a .NET Framework issue and not the programmer.
and you just cant google a answer.
this is what you can do.
if you use a button to run the code
Code: Select all
Add a Timer control to your project.Dim bmp as new BitMap("path_to_image")
bmp.Save("new_image_path_&_name.ext",System.Drawing.Imaging.ImageFormat.FILE_EXTENTION)
Set it for 3 to 5 seconds 3000/5000
Timer.Interval = 3000 to 5000
Timer.Enabled = True
Timer.Start()
Code: Select all
Dim bmp as new BitMap("path_to_image")
bmp.Save("new_image_path_&_name.ext",System.Drawing.Imaging.ImageFormat.FILE_EXTENTION)
ButtonYouJust_Clicked.Enabled = False
Timer.Interval = 3000 to 5000
Timer.Enabled = True
Timer.Start()
Now in the Timer_Tick Event simple re-enable the button and turn the timer off
Code: Select all
ButtonYouJust_Clicked.Enabled = True
Timer.Enabled = False
Timer.Stop()
All this does is disables the Button or whatever control until the GDI+ has finished what it is doing in the background.
normally a few seconds depending on the size of the image. but a minimum of 3 seconds is a good start.
And another piece or advise. on GDI+
If you are working on a Image and you keep getting the Access Denied error message.
This is because the Image is "Open or being used". You need to .Close() or .Dispose() of the image first
then you can continue work work on it.
Believe it or not, this error is really a .NET Framework issue and not the programmer.
1 post
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023