PC Review


Reply
Thread Tools Rate Thread

Another "A generic error occured in GDI+" Error

 
 
lgbjr
Guest
Posts: n/a
 
      9th Mar 2005
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


 
Reply With Quote
 
 
 
 
JohnFol
Guest
Posts: n/a
 
      9th Mar 2005
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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
lgbjr
Guest
Posts: n/a
 
      9th Mar 2005
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" <(E-Mail Removed)> wrote in message
news:yaAXd.457$(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> 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
>>

>
>



 
Reply With Quote
 
JohnFol
Guest
Posts: n/a
 
      9th Mar 2005
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" <(E-Mail Removed)> wrote in message
news:OIO$(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:yaAXd.457$(E-Mail Removed)...
>> 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" <(E-Mail Removed)> wrote in message
>> news:%(E-Mail Removed)...
>>> 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
>>>

>>
>>

>
>



 
Reply With Quote
 
JohnFol
Guest
Posts: n/a
 
      9th Mar 2005
Found an article that may help rule out any permission properties . .

http://groups.google.co.uk/groups?hl...3DN%26tab%3Dwg






"lgbjr" <(E-Mail Removed)> wrote in message
news:OIO$(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:yaAXd.457$(E-Mail Removed)...
>> 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" <(E-Mail Removed)> wrote in message
>> news:%(E-Mail Removed)...
>>> 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
>>>

>>
>>

>
>



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      9th Mar 2005
"lgbjr" <(E-Mail Removed)> 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/>

 
Reply With Quote
 
lgbjr
Guest
Posts: n/a
 
      9th Mar 2005
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]" <hirf-spam-me-(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> "lgbjr" <(E-Mail Removed)> 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/>



 
Reply With Quote
 
Peter Huang [MSFT]
Guest
Posts: n/a
 
      10th Mar 2005
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.

 
Reply With Quote
 
lgbjr
Guest
Posts: n/a
 
      10th Mar 2005
Peter,

OK, that sounds like a good suggestion! Can you post the link you mentioned.

Thanks
Lee

""Peter Huang" [MSFT]" <v-(E-Mail Removed)> wrote in message
news(E-Mail Removed)...
> 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.
>



 
Reply With Quote
 
Peter Huang [MSFT]
Guest
Posts: n/a
 
      10th Mar 2005
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&rnum=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%26rnum%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.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
error message "an unexpected error has occured" Chuckinvt Microsoft Outlook Contacts 3 5th Sep 2008 08:00 PM
" runtime error 2753 an error occured while communicating to OLE server or ActiveX control" az Microsoft Access VBA Modules 0 12th Sep 2006 04:29 AM
"A Disk Read Error Occured" error source Mr. Frazzlebottom Storage Devices 15 25th Jan 2006 10:09 PM
""Generic Host Process for Win32 Services"" error!!! ÀÌÇØÁÖ Windows XP General 1 12th May 2005 11:03 AM
Printing Error,"An error occured during this operation". JAY Windows XP Print / Fax 0 11th Aug 2004 11:50 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:18 AM.