You are here:

FoxPro/jpg file control.

Advertisement


Question
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,

Thanks

Answer
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...

ON A FORM:

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).

ON A REPORT:

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,

Fred

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.

FoxPro

All Answers


Answers by Expert:


Ask Experts

Volunteer


Fred Frase

Expertise

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.

Experience

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

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

©2016 About.com. All rights reserved.