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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image in Visual Fox 2

Status
Not open for further replies.

JaPoChi

Technical User
Feb 19, 2011
11
RO
I have a database in Visual Fox and I want to display an image depending on a field. For example, for the table 'player', for each player to display an different image. Please explain me how to do this! I'm a begginer in this program. Thanks a lot!
 
You need an image control for each player and then need to loop through all relevant records and set imagecontrol.picture to a file name of a picture.

Bye, Olaf.
 
Related to tek-tips: Welcome to this forum.

If you ask a question, please start a thread as a question and not as a helpful tip.

Bye, Olaf.
 
ok..but how can I do that? I tried to do a general field, but if I try to do a report it appears the adress, not the image. Please explain step by step.
I also tried to do a memo field, or a character field and to use the function strtofile() but it appears an error [when I wrote strtofile(tablename.field) it appeared :"too few arguments"].

 
Are you trying to create a report or a form?

If it's a report, you first need to add a field to hold the path and filename of the image. Add that to the table or cursor that drives the report.

Next, drop a Picture/OLE Bound control on the report.

Right-click on the Picture/OLE Bound control, and select Properties. In the properties dialogue, set "Control Source Type" to "Expression or Variable Name", and set the Control Source to the field that contains the filename.

If you are doing something other than a report, please explain what you are tying to do.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Yes, it's important to know if you want to do a report or a form. I thought you were talking about a form.

Bye, Olaf.
 
Thanks a lot! I was trying to do a report. It's my bad I didn't mentioned that. I succeed in doing a report, but if you want to explain me how to do a form also, I will be grateful.

Thanks!
 
Well, I did so, but I could perhaps elaborate a little more.

As always there is more than one way, but as you are now with filenames in your data, assume your table is called "players" and has a field named "picture" in it, you show one record in an image control by setting the imagecontrol picture property to players.picture.

An image control has no controlsource, so you need to program that line "image1.picture = players.picture" somewhere in a method you run, when the record changes, eg in a skip button in it's click.

Are you using the form wizards to create your forms?

Bye, Olaf.
 
I tell you. She created her report. :) Together we tried to do this and it worked. Thanks!
 
I like new form than form wizard. But I think I understand from your replies how to introduce an image in a form. Thanks for your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top