Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Stefan Wuebbe
  Where is Stefan Wuebbe?
 Hamburg
 Germany
 Stefan Wuebbe
 To: JaiPrakash Bhandari
  Where is JaiPrakash Bhandari?
 Hyderabad
 India
 JaiPrakash Bhandari
 Tags
Subject: RE: Not loading image on Image control
Thread ID: 249073 Message ID: 249082 # Views: 1 # Ratings: 0
Version: Visual FoxPro 9 Category: Forms
Date: Monday, December 28, 2009 10:09:53 AM         
   


> Hello
> I have an Image control on a form and user selects an image file through GETFILE() option.
> But, we know that there are some image files(such as Bitmap, Png, etc), which does not have any Preview or of not correct/valid image files. In that particular case, the Image is not showing on the Forms Image control(means not loading the image properly), instead it's showing the Image control like in design view(with crossed lines).
> Those Image files, if open from Explorer, generally shows "No Preview available". This type of files are easily available from '%Temp%' folder.
> Is there any way to detect those files and to prevent from showing the Image control as in design view ?
>

Hi Bhandari,

I do not have such a file here for testing - but if I remember correctly, in similar cases the image.Picture property was empty here right after the GetFile() result assign. If so, you can perhaps do something like:
Local lcFile
lcFile = Lower(GetFile())
If Not Empty(m.lcFile)
    theImage.Picture = m.lcFile
    If Not ( Lower(m.theImage.Picture) == m.lcFile ) && invalid file
        && assign a placeholder picture here,
        && or a label.Caption saying something like "invalid file chosen"
    Endif
Endif




hth
-Stefan

ENTIRE THREAD

Not loading image on Image control Posted by JaiPrakash Bhandari @ 12/28/2009 8:21:20 AM
RE: Not loading image on Image control Posted by Stefan Wuebbe @ 12/28/2009 10:09:53 AM
RE: Not loading image on Image control Posted by Ammar Hadi @ 12/28/2009 11:45:47 PM