Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Set safety on
Message
From
14/01/2006 11:59:34
Mike Yearwood
Toronto, Ontario, Canada
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01086803
Message ID:
01086823
Views:
54
>How can I get the information what the user chose (Yes or No) when the message “The file 'filename' already exist, overwrite it?” pops up?

You should test for the file existence first, then overwrite. The SAFETY function should be ON by default. FoxPro can be used to data processing work from the command line. In such instances, overwriting the file by default could be dangerous.

IF FILE('SomeFile')
IF MESSAGEBOX("File exists. Overwrite?",36) = 6
LOCAL m.lcOldSafety
m.lcOldSafety = SET("SAFETY")
SET SAFETY OFF
*Overwrite the file.
SET SAFETY &lcOldSafety.
ENDIF
ENDIF
Previous
Reply
Map
View

Click here to load this message in the networking platform