Hello All,
I have some pictureboxes on a VB.NET form that are linked to an AccessDB. If
the user wishes to open or edit an image, I need to save the image in the
picturebox to a temp file, then open that file in whatever viewer/editor is
the default for the users system. I tried to do
picturebox1.image.save(filename), which results in "A Generic error occured
in GDI+".
However, if I use an unbound picturebox, do a
picturebox2.image=image.fromfile(filename1), then do a
picturebox2.image.save(filename), it works fine.
My GDI+ error is not being caused by a permissions problem, as I'm using the
same folder for the bound and unbound picturebox. It seems that it has
something to do with the way the picturebox retrieves the image information
from the database. Is there a way around this?
Regards and TIA,
Lee 13 4580
It might be worth trying the same experiment on an image not held in Access.
It stores a 78 byte header in front of the image information. Not sure if
this is causing the problem, but hopefully narrows down the cause.
"lgbjr" <lg***@online.nospam> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl... Hello All,
I have some pictureboxes on a VB.NET form that are linked to an AccessDB. If the user wishes to open or edit an image, I need to save the image in the picturebox to a temp file, then open that file in whatever viewer/editor is the default for the users system. I tried to do picturebox1.image.save(filename), which results in "A Generic error occured in GDI+".
However, if I use an unbound picturebox, do a picturebox2.image=image.fromfile(filename1), then do a picturebox2.image.save(filename), it works fine.
My GDI+ error is not being caused by a permissions problem, as I'm using the same folder for the bound and unbound picturebox. It seems that it has something to do with the way the picturebox retrieves the image information from the database. Is there a way around this?
Regards and TIA, Lee
Well, that's what I was thinking, since the unbound picturebox can save an
image to a file, but the bound picturebox (to Access) can not. However, in
the past few minutes (after my original post), I found that there are
certain images stored in the AccessDB that will save without the GDI+ error.
Comparing an image that will save from the picture box to one that won't:
No error image:
JPG 150x150 (a small image)
Error Image:
JPG 1024x768 (a big image)
I'm going to create some different versions of the image that produces the
GDI+ error and see if I can figure out what the limitation is (maybe pixel
HxW, maybe file size, maybe aspect, maybe color depth, etc.). Just an FYI,
all of the images in the AccessDB, except one, cause the GDI+ error.
If anyone has run into this before, please let me know (as I don't want to
waste too much time experimenting if there's already a known solution!)
"JohnFol" <Ou************@WibbleObbble.Com> wrote in message
news:ya***************@newsfe1-gui.ntli.net... It might be worth trying the same experiment on an image not held in Access. It stores a 78 byte header in front of the image information. Not sure if this is causing the problem, but hopefully narrows down the cause. "lgbjr" <lg***@online.nospam> wrote in message news:%2****************@TK2MSFTNGP15.phx.gbl... Hello All,
I have some pictureboxes on a VB.NET form that are linked to an AccessDB. If the user wishes to open or edit an image, I need to save the image in the picturebox to a temp file, then open that file in whatever viewer/editor is the default for the users system. I tried to do picturebox1.image.save(filename), which results in "A Generic error occured in GDI+".
However, if I use an unbound picturebox, do a picturebox2.image=image.fromfile(filename1), then do a picturebox2.image.save(filename), it works fine.
My GDI+ error is not being caused by a permissions problem, as I'm using the same folder for the bound and unbound picturebox. It seems that it has something to do with the way the picturebox retrieves the image information from the database. Is there a way around this?
Regards and TIA, Lee
You could use Access to "launch" the image ie, double click the field. Then,
using whatever viewer is launched (probably iexplore) save the file to a new
location.
Go back into the Access table and add a new row using the new file.
The reason for doing this is it takes a known good image that can be
displayed (because you see it in IExplore), that is saved to disk by a
separate application, and added to a new row in Access, possibly ruling out
anything strange with the record.
"lgbjr" <lg***@online.nospam> wrote in message
news:OI**************@TK2MSFTNGP10.phx.gbl... Well, that's what I was thinking, since the unbound picturebox can save an image to a file, but the bound picturebox (to Access) can not. However, in the past few minutes (after my original post), I found that there are certain images stored in the AccessDB that will save without the GDI+ error.
Comparing an image that will save from the picture box to one that won't:
No error image: JPG 150x150 (a small image) Error Image: JPG 1024x768 (a big image)
I'm going to create some different versions of the image that produces the GDI+ error and see if I can figure out what the limitation is (maybe pixel HxW, maybe file size, maybe aspect, maybe color depth, etc.). Just an FYI, all of the images in the AccessDB, except one, cause the GDI+ error.
If anyone has run into this before, please let me know (as I don't want to waste too much time experimenting if there's already a known solution!) "JohnFol" <Ou************@WibbleObbble.Com> wrote in message news:ya***************@newsfe1-gui.ntli.net... It might be worth trying the same experiment on an image not held in Access. It stores a 78 byte header in front of the image information. Not sure if this is causing the problem, but hopefully narrows down the cause. "lgbjr" <lg***@online.nospam> wrote in message news:%2****************@TK2MSFTNGP15.phx.gbl... Hello All,
I have some pictureboxes on a VB.NET form that are linked to an AccessDB. If the user wishes to open or edit an image, I need to save the image in the picturebox to a temp file, then open that file in whatever viewer/editor is the default for the users system. I tried to do picturebox1.image.save(filename), which results in "A Generic error occured in GDI+".
However, if I use an unbound picturebox, do a picturebox2.image=image.fromfile(filename1), then do a picturebox2.image.save(filename), it works fine.
My GDI+ error is not being caused by a permissions problem, as I'm using the same folder for the bound and unbound picturebox. It seems that it has something to do with the way the picturebox retrieves the image information from the database. Is there a way around this?
Regards and TIA, Lee
Found an article that may help rule out any permission properties . . http://groups.google.co.uk/groups?hl...3DN%26tab%3Dwg
"lgbjr" <lg***@online.nospam> wrote in message
news:OI**************@TK2MSFTNGP10.phx.gbl... Well, that's what I was thinking, since the unbound picturebox can save an image to a file, but the bound picturebox (to Access) can not. However, in the past few minutes (after my original post), I found that there are certain images stored in the AccessDB that will save without the GDI+ error.
Comparing an image that will save from the picture box to one that won't:
No error image: JPG 150x150 (a small image) Error Image: JPG 1024x768 (a big image)
I'm going to create some different versions of the image that produces the GDI+ error and see if I can figure out what the limitation is (maybe pixel HxW, maybe file size, maybe aspect, maybe color depth, etc.). Just an FYI, all of the images in the AccessDB, except one, cause the GDI+ error.
If anyone has run into this before, please let me know (as I don't want to waste too much time experimenting if there's already a known solution!) "JohnFol" <Ou************@WibbleObbble.Com> wrote in message news:ya***************@newsfe1-gui.ntli.net... It might be worth trying the same experiment on an image not held in Access. It stores a 78 byte header in front of the image information. Not sure if this is causing the problem, but hopefully narrows down the cause. "lgbjr" <lg***@online.nospam> wrote in message news:%2****************@TK2MSFTNGP15.phx.gbl... Hello All,
I have some pictureboxes on a VB.NET form that are linked to an AccessDB. If the user wishes to open or edit an image, I need to save the image in the picturebox to a temp file, then open that file in whatever viewer/editor is the default for the users system. I tried to do picturebox1.image.save(filename), which results in "A Generic error occured in GDI+".
However, if I use an unbound picturebox, do a picturebox2.image=image.fromfile(filename1), then do a picturebox2.image.save(filename), it works fine.
My GDI+ error is not being caused by a permissions problem, as I'm using the same folder for the bound and unbound picturebox. It seems that it has something to do with the way the picturebox retrieves the image information from the database. Is there a way around this?
Regards and TIA, Lee
"lgbjr" <lg***@online.nospam> schrieb: Well, that's what I was thinking, since the unbound picturebox can save an image to a file, but the bound picturebox (to Access) can not. However, in the past few minutes (after my original post), I found that there are certain images stored in the AccessDB that will save without the GDI+ error.
Comparing an image that will save from the picture box to one that won't:
No error image: JPG 150x150 (a small image) Error Image: JPG 1024x768 (a big image)
I suggest to check if the data read from the database is the same data that
is stored in the image file that has been inserted into the database.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Hmmm, Very Good Point!! This is what I've found. First, the Pic filed type
in the AccessDB is OLE Object. I have a button on my VB.NET form that calls
an OpenFile Dialog for the user to select a picture (now limited via a
filter to JPGs). The JPG file selected in the dialog is used to display the
image in the picturebox (picturebox.image=image.fromfile(dialog.filename)
I never actually looked back at the AccessDB, simply because as I selected
new records in my VB form, the pictures that were added were always shown in
the pictureboxes correctly.
Well, here's the situation. If I look at the AccessDB, the Pic field does
not contain an OLE object (package). It says Long binary Data, and I can't
view the image. If I right click on a PIC cell and insert a JPG (from file),
the cell shows as a package (and I can double-click to open the image).
However, if I now go back to my VB.NET form, the records that have a package
in the pic field will not display the picture in the picture box.
Still, some of the pictures that are saved to the AccessDB via the
picturebox (Long Binary Data) can be saved back to disk via
picturebox.image.save, some can not. So, I think I might have two problems.
First is how to save an image in a picturebox back to the AccessDB as a
package and/or how to view a picture stored as a package in the AccessDB in
a picturebox. Maybe, if I can fix this issue, the GDI+ issue will go away.
Regards,
Lee
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... "lgbjr" <lg***@online.nospam> schrieb: Well, that's what I was thinking, since the unbound picturebox can save an image to a file, but the bound picturebox (to Access) can not. However, in the past few minutes (after my original post), I found that there are certain images stored in the AccessDB that will save without the GDI+ error.
Comparing an image that will save from the picture box to one that won't:
No error image: JPG 150x150 (a small image) Error Image: JPG 1024x768 (a big image)
I suggest to check if the data read from the database is the same data that is stored in the image file that has been inserted into the database.
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
Hi
I think we need to stored the picture in access as the binary data without
the ole header.
While the picture added by access will have the oleheader which is not
supported in OLEDB provide of ADO.NET, so we need to stripe it off to
retrieve the data directly.
Here is a google link for your reference.
Best regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Peter,
OK, that sounds like a good suggestion! Can you post the link you mentioned.
Thanks
Lee
""Peter Huang" [MSFT]" <v-******@online.microsoft.com> wrote in message
news:p8**************@TK2MSFTNGXA02.phx.gbl... Hi
I think we need to stored the picture in access as the binary data without the ole header. While the picture added by access will have the oleheader which is not supported in OLEDB provide of ADO.NET, so we need to stripe it off to retrieve the data directly. Here is a google link for your reference.
Best regards,
Peter Huang Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security This posting is provided "AS IS" with no warranties, and confers no rights.
Hi Lee,
Sorry for that.
Here is the link. http://groups.google.com/groups?hl=z...4-43,GGLD:en&t
hreadm=uAQhoo05EHA.2680%40cpmsftngxa10.phx.gbl&rnu m=1&prev=/groups%3Fq%3Dv-k
evy%2Bole%2Bheader%26hl%3Dzh-CN%26lr%3D%26rls%3DGGLD,GGLD:2004-43,GGLD:en%26
selm%3DuAQhoo05EHA.2680%2540cpmsftngxa10.phx.gbl%2 6rnum%3D1
Best regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Peter,
for some reason, I always have trouble when someone sends me a google link.
I can never get the page to load. If you can tell me the string you searched
for and what result you selected, I can just do my own search from here.
Thanks
Lee
""Peter Huang" [MSFT]" <v-******@online.microsoft.com> wrote in message
news:5p*************@TK2MSFTNGXA02.phx.gbl... Hi Lee,
Sorry for that. Here is the link. http://groups.google.com/groups?hl=z...4-43,GGLD:en&t hreadm=uAQhoo05EHA.2680%40cpmsftngxa10.phx.gbl&rnu m=1&prev=/groups%3Fq%3Dv-k evy%2Bole%2Bheader%26hl%3Dzh-CN%26lr%3D%26rls%3DGGLD,GGLD:2004-43,GGLD:en%26 selm%3DuAQhoo05EHA.2680%2540cpmsftngxa10.phx.gbl%2 6rnum%3D1
Best regards,
Peter Huang Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security This posting is provided "AS IS" with no warranties, and confers no rights.
Hi
Ok, I think you may just search the string below in the groups.google.com
"Error " Invalid Parameter Used" when I try to display an image"
If you still have any concern, please feel free to post here.
Best regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Peter,
I found a solution to my GDI+ problem! finally! Instead of trying to
retrieve the image from the picturebox, I'm going back to the AccessDB using
an OLEDBDataReader to get the data from the OLE Object field, and then using
a BinaryWriter to write the data to a file. Works perfectly.
I think the problem is not with the picturebox, or the AccessDB, but with
the dataset that is created from the OLEDataAdapter. for an Ole Object
field, the Schema type is set to Base64Binary. This works fine for
displaying the image in a picturebox. But, in reality, an Ole Object field
in the AccessDB is Base128Binary.
I'd like to, some day, write a new type for the dataset schema that is
Base128Binary, but for now, retrieving the image directly from the Access
table is working.
thanks for all of your help!!!
Regards,
Lee
""Peter Huang" [MSFT]" <v-******@online.microsoft.com> wrote in message
news:T1**************@TK2MSFTNGXA02.phx.gbl... Hi
Ok, I think you may just search the string below in the groups.google.com "Error " Invalid Parameter Used" when I try to display an image"
If you still have any concern, please feel free to post here.
Best regards,
Peter Huang Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security This posting is provided "AS IS" with no warranties, and confers no rights.
Hi
I am glad that your project has worked.
Cheers!
Best regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Michael Kennedy [UB] |
last post by:
Hi Everyone,
I have this multithreaded C# windows forms application which does a lot of
image processing. Occasionally, I get the following error:
A generic error occurred in GDI+....
|
by: Vicente Nicolau |
last post by:
hello,
I have a problem when I preview or print a document in an ISO A0. I have an
application which load an 10x10 image (bmp or
jpg) and spread it in the A0 paper. When I make the print...
|
by: Alphonse Giambrone |
last post by:
I am currently reading 'Programming The Web with Visual Basic .NET' and
have so far found it to be excellent. Downloaded all the code from Apress
and working in chapter 4, I get the error shown...
|
by: David Lozzi |
last post by:
Howdy,
I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders!
Now I am making a public function that will take the...
|
by: nor |
last post by:
Hi,
I've application to capture video of image and grab the still image. It runs well untill I put loop to regrab the still images many times automatically.. and the error (generic error occured...
|
by: labby |
last post by:
I've application to capture video of image and grab the still image. It runs well untill I put loop to regrab the still images many times automatically.. and the error (generic error occured GDI+)...
|
by: James Wong |
last post by:
Hi everybody,
I'm facing a serious trouble relating to GDI+ generic error. The error
message is "A Generic error occured in GDI+" and the following information
is stored in Excepton object:...
|
by: =?Utf-8?B?Sm9hY2hpbQ==?= |
last post by:
I have a bitmap which I have retreived through the WebBrowser DrawToBitmap
method into a Bitmap. When I try to save the bitmap I get
"ExternalException occurred
A generic error occurred in...
|
by: Adnan Chaudhry |
last post by:
Hi
I'm trying to open, edit and save an animated gif.
When saving frame 2 - I get the following error.
A generic error occured in GDI+ when i reach the following step.
img.SaveAdd(img2,...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
|
by: Aliciasmith |
last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
|
by: Teri B |
last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course.
0ne-to-many. One course many roles.
Then I created a report based on the Course form and...
|
by: nia12 |
last post by:
Hi there,
I am very new to Access so apologies if any of this is obvious/not clear.
I am creating a data collection tool for health care employees to complete. It consists of a number of...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
| |