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 a form 1

Status
Not open for further replies.

JaPoChi

Technical User
Feb 19, 2011
11
RO
I have a project with four tables and one of them has a field which retains the address of a picture. Now, I'm trying to create a form and I don't know how to upload the picture. My problem is that I don't want to introduce the address from the keyboard, I want to browse it and to retain the address automatically. I use the form to add informations in the table.
 
First, you need to add an Image control to the form.

Next, set the Picture property of the control to the address of the image. Basically, that's all there is to it.

But, given that the addresses are stored in a table, the form will presumably have some way of navigating from one record to another. At the point at which you arrive at a new record, that's where you set the Picture property.

So, for example, if the table is MyTable and the field holding the address of the picture is MyPic, this is the code:

THISFORM.Image1.Picture = MyTable.MyPic.

Hope this makes sense.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
If the images are stored on disk and you're "browsing for" them there, use Getpict() to return the path/filename. Then set an image control's picture property per Mike's suggestion.
 
I'm confused. I don't think I understand. I attached a picture with a form. In the left I made a printscreen of the formular and in the right I made a printscreen of the code that I use to add new informations into my table. So I need a button that allows me to browse [I need the code] or a empty control which allows me to drag the photo there. It is that possible?
 
 http://www.mediafire.com/i/?n5bji8au1my12do
So I need a button that allows me to browse [I need the code] or a empty control which allows me to drag the photo there. It is that possible?

Both are possible, but they are entirely different.

To invoke a "browse" for pictures put this code in your button's click method:
Code:
lcPict = Getpict()
You should store the value found in lcPict to either a form control or a table field as needed.

Drag/drop is a far more complex option.

Dan
 
Thanks a lot! I solved the problem and now works. I'm really grateful!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top