Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
LOCFILE() problems
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00096641
Message ID:
00096680
Views:
13
>I have two problems in LOCFILE() function, they are :
>- I have specified the cDialogCaption, but it doesn't work the Caption does not exist.
>- If I exit the Open dialog box by choosing Cancel, pressing ESC, or choosing Close from the Control menu, VFP generates an error message and LOCFILE( ) doesn’t return a value. I do not want the program show the error message how to solve this problem ( I don't want to use ON ERROR function )

It sounds like you're trying to use LOCFILE() the same way that the way that the FPW/FPD GENSCRN program did, namely:
USE LOCFILE(filename, 'DBF', 'Where is ' + filename + '?') IN 0
IMHO, you shouldn't because if LOCFILE() can't find the file and the user cancels, there's no way to prevent an error from occurring.

Much better is to use the FILE() function to determine the whether or not the file exists. If it doesn't you can use the GETFILE() function to prompt the user for the location. If the user doesn't locate the file, you can then exit the routine gracefully.

Regarding the caption, this is the prompt that will appear to the left of the file name region in the dialog. There's not much room there, so your prompt is probably being truncated.

hth,
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform