Board index » delphi » DBImage and OpenPictureDialog

DBImage and OpenPictureDialog

Hi Folks,

I am trying to use the following piece of code in Delphi 7.

DBImage.Picture.LoadFromFile(OpenPictureDialog.FileName);

The OpenPictureDialog opens properly and shows the picture that I wish to
load. When I click on the OPEN button I receive a Unknown picture file
extension() error.

If I hard code the file name DBImage.Picture.LoadFromFile('C:\picture.bmp');

It works properly. When I use a ShowMessage to see what the filename is it
comes out as garbage not a string.

Any ideas?

 

Re:DBImage and OpenPictureDialog


Quote
Brian wrote:
> Hi Folks,

> I am trying to use the following piece of code in Delphi 7.

> DBImage.Picture.LoadFromFile(OpenPictureDialog.FileName);

> The OpenPictureDialog opens properly and shows the picture that I wish to
> load. When I click on the OPEN button I receive a Unknown picture file
> extension() error.

> If I hard code the file name DBImage.Picture.LoadFromFile('C:\picture.bmp');

> It works properly. When I use a ShowMessage to see what the filename is it
> comes out as garbage not a string.

> Any ideas?

You could try

if OpenPictureDialog.Execute then
   DBImage.Picture.LoadFromFile(OpenPictureDialog.FileName);

HTH

Arno

Re:DBImage and OpenPictureDialog


Excellent!

That certainly solved the problem.

Now is there a certain way to save this image into a Microsoft Access Field?

Brian

Re:DBImage and OpenPictureDialog


Quote
Brian wrote:
> Excellent!

> That certainly solved the problem.

> Now is there a certain way to save this image into a Microsoft Access
> Field?

You can save it into a BLOB field, no problem. That's OK if the data is
only accessed by your application. Access would not recognize it as an
image, though.

--
Peter Below (TeamB)  
Don't be a vampire (http://slash7.com/pages/vampires),
use the newsgroup archives :
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be

Other Threads