dalegoble


I have a form with a picture box. I store the path to the photo in a table and
retreave it to show the picture, works great.
But what i need to do is when there is no picture on that record make
the picture box container non visable on the form.
Can I do this with code
Thanks
Dale



Re: Empty Picture Box

dni


You may put a picture with "No picture available" for EMPTY("path") = .T. or you may hide it with

thisform.Image.Visible = .F.







Re: Empty Picture Box

hangover

Sure. You just need to amend the code which moves the record pointer (or directly changes the Picture property of the Image control) such that the Visible property of the Image control is set to False when the relevant field is empty, i.e.

THISFORM.myImageControl.Visible = NOT EMPTY (mytable.myfield)







Re: Empty Picture Box

PB_UK

you could also use the file() function to check the validity of the file instead of just blank/non-blank

thisform.myImageControl.Visible = iif(file(mytable.myfield),.t.,.f.)

or, you could place it in a refresh method of the item itself with:

this.visible = iif(file(mytable.myfield),.t.,.f.)






Re: Empty Picture Box

Markish

Hi,

I would suggest you to combine the both "file()" and "default image" / "No image available" image for handling such situation. I prefer using a meaningful deafult image.

Best regards,

Markish






Re: Empty Picture Box

Bernard Bout

Never use the FILE() function if the path points to a network resource. If you do and if the resource is not available for any reason, your app and computer will lock up while windows searches for the network.

The best way is

Thisform.Picturebox.visible = NOT EMPTY(ThisForm.PictureBox.Picture)





Re: Empty Picture Box

CetinBasoz

Create an image class with Picture_Assign method:

lparameters vNewValue

this.Picture = m.vNewValue

this.Visible = !empty(m.vNewValue)