Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to display image on a form and report in Visual FoxPro 9 1

Status
Not open for further replies.
Sep 26, 2020
11
IN
Hi Friends,
In VPF9, I have created a form which contains
========
a Button-AddImage, in its click event the codes are
GF=""
GF=GETFILE()
THISFORM.IMAGEFILENAME.Value=GF
========
and
a Text Box- ImageFileName.
=======
When I click the Add Image button, only the file name with path of selected image is being displayed in the text box. As per my requirement, I just save the path of that selected image in my .DBF. I do not want to save the entire image in .DBF file. But I want how to display that selected image on the same form and on report also.

Thank u all in advance.
 
In your form, add an Image control. Then set its Picture property to the filename of your image file. If the file is not in your VFP search path and is not bound into the EXE at run time, include the full path.

In your report, insert a Picture / OLE Bound control. In its properties dialogue, set "Control source type" to "Image filename" (which is the default); and set "Control source" to the picture's filename (including path if necessary, as above).

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
A couple of other small points:

- Instead of GETFILE(), you can use GETPICT(). From the user's point of view, they are very similar, but GETPICT() has the advantage that "File of type" is pre-set to all the VFP supported image types.

- Whenever calling GETPICT(), GETFILE() or similar functions, always check to see if the reply is an empty string. If it is, it means the user has cancelled the dialogue, in which case you should not proceed with your action.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top