You are here:

FoxPro/jpg file control.


I am using vfp 9.
I have ten student's jpg file in pict folder.
I am creating student information system in vfp9.
I want store student's jpg with student record. in dbf and display on form and report also
pl. help me sir,


Hi, Vineet

Displaying the image on forms and reports is fairly easy, but storing the picture in the DBF is something I have not been able to figure out.  I'll give you the theory, maybe you'll have better luck.  You can add a field to your table to store the image.  When you create the field, the field type should be GENERAL.  This field can be used to store images, spreadsheets, etc.  To store data, use the INSERT GENERAL command.  Now, the problem:  I've never been able to get the picture to store.  It seems to store the icon and that's all I get when I try to add it to a report or a form.

However, if you can live with keeping only the file name of the image in your database, and keeping the JPG as separate files, everything else will work.  Control and the proper object are a little different between forms and reports...


Use "Image" as your object type.  Use the "Picture" property to determine what image is to be displayed.  At design time, you can leave this property as (none).  The property should be assigned during the forms initialization (INIT Method) using:
     THISFORM.<ImageObjectName>.Picture = <FieldName>
     (FieldName from the table storing the name of the JPG file).


Use "Picture/OLE Bound Control" as the object type.  Open the "Properties" window; on the "General" tab, select "Expression or Variable Name" from the Control Source Type radio group.  The next item, "Control Source" is the name of the field in the table which has the file name of the image.

If you have additional questions/issues, please post a follow-up.
Good Luck,


P.S. Please enter a rating so you can access the COMMENTS to let me know if it worked out.  
I'm far more interested in knowing if it helped than in the rating system.


All Answers

Answers by Expert:

Ask Experts


Fred Frase


Questions about development only. No installation or hardware specific questions, please. Your first step in requesting assistance should be to identify the version of FoxPro you are using. I can write short functions but, PLEASE do not ask me to write programs for you.


Nearly 30 years professional programming experience using FoxPro (FoxBase through VFP 9) or other xbase language, primarily in Windows environments.

Completed a 1,000 hour diploma course in programming at International Academy of Ohio (subsequently merged with Southern Ohio College).

©2017 All rights reserved.