Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Type of images
Message
From
03/10/2006 04:33:07
 
 
To
03/10/2006 03:39:29
General information
Forum:
Visual FoxPro
Category:
Pictures and Image processing
Title:
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01158496
Message ID:
01158785
Views:
28
This message has been marked as a message which has helped to the initial question of the thread.
You must use adir() to check what kind of file really exists on your computer. Then you must change the line
lcImageFile = "images\"+alltrim(str(thisform.text1.value)) +(".jpg")+(".GIF") accordingly! Something like this
lcImagefile="images\"+alltrim(str(thisform.text1.value))
if adir(temp,lcImagefile+'.*')#1
  messagebox('You either have zero, or more than one file, with this name')
else
  lcImagefile=lcImagefile+justext(temp(1))
endif




>hi,
>thank you ,
>i spend more...
>try understand , i will...
>
>i change it but i see only this message...
>the picture dos'nt exist-filename image\1.jpg .gif
>
>i know becuse this... +(".jpg")+(".GIF"),
>
>that is mean go back the first point...
>
>IF !EOF()
>   thisform.text1.value=thisform.text1.value+1
>   thisform.text2.value=nam
>   local lcImageFile
> lcImageFile = "images\"+alltrim(str(thisform.text1.value)) +(".jpg")+(".GIF")
>if file(lcImageFile)
>   ThisForm.Image1.Picture = lcImageFile
>else
>   MessageBox("The picture doesn't exist - filename: " + lcImageFile)
>endif
> SKIP
> else
>  skip -1
>ENDIF
>
>
>>Of course you get an error! You changed Hilmar's lcImagefile variable into lcFilename, and by doing so, you create an error! Do you ever spend more than one second thinking why? And please, please, please try understand how things work, and you will see these things yourself. If you don't even try to find these easy-to-see errors yourself, how can you expect any help?
>>
>>NB! Change lcFilename into lcImagefile .......
>>
>>>hi,
>>>thank you for reply,
>>>i try as under , but i got error message Variable "lcFileName" is not found
>>>
>>>**at  command button via click event
>>>IF !EOF()
>>>   thisform.text1.value=thisform.text1.value+1
>>>   thisform.text2.value=nam
>>>   local lcImageFile
>>> lcImageFile = "images\"+alltrim(str(thisform.text1.value)) +(".jpg")+(".GIF")
>>>if file(lcImageFile)
>>>   ThisForm.Image1.Picture = lcImageFile
>>>  SKIP
>>>else
>>>   MessageBox("The picture doesn't exist - filename: " + lcFileName)
>>>  skip -1
>>>endif
>>>ENDIF
>>>
>>>
>>>
>>>>>Hi,
>>>>>
>>>>>thank you for reply, i don't know what you mean?
>>>>
>>>>Tore means that you should use the debugger (or any other debugging technique, like showing information with a WAIT command or with a MessageBox()), to see what is the name of the file you are trying to fetch. Then, you can see if the file exists, or if it even has a correct name.
>>>>
>>>>You should change your code, to make debugging easier. Specifically, you should separate the filename to a variable, like this:
>>>>
>>>>
>>>>local lcImageFile
>>>>lcImageFile = "images\"+alltrim(str(thisform.text1.value))+(".GIF") +(".jpg")&& or and +(".jpg")
>>>>MessageBox("The filename is: " + lcImageFile)
>>>>Thisform.Image1.Picture = lcImageFile
>>>>
>>>>
>>>>If you separate the filename into a variable, as in my code above, it is easier to debug (debug means to find errors).
>>>>
>>>>The MessageBox() command was inserted to show if the file name is correct. Once it works, you can take MessageBox() out; instead, you can add other commands, for example, to test whether the file, specified by the user, exists:
>>>>
>>>>
>>>>if file(lcImageFile)
>>>>  ThisForm.Image1.Picture = lcImageFile
>>>>else
>>>>  MessageBox("The picture doesn't exist - filename: " + lcFileName)
>>>>endif
>>>>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform