#### Sample Code for File Dialog

The sample code below should be entered inside the Edit window's Command Mode, not inside the File I/O dialog box.

The following code submits a dialog box that allows you to choose a file to delete.

V1=FILE/DIALOG,Choose a file to delete.

V2=FILE/EXISTS,V1

IF/V2<>0

COMMENT/OPER,File exists. Ready to delete.

FILE/DELETE,V1

V3=FILE/EXISTS,

IF/V3==0

COMMENT/OPER,File deleted successfully

PROGRAM/END

END_IF/

ELSE/

COMMENT/OPER,File still exists

PROGRAM/END

END_ELSE/

END_IF/

COMMENT/OPER,File doesn't exist to delete. Choose a file that exists.

Much of this code is similar to that explained in "Sample Code for Read Character" or in "Sample Code for Read Line".

Only explanations unique to this example are given here.

V1=FILE/Dialog,Choose a file to delete
This line displays a dialog box with the title "Choose a file to delete". You can browse to a file and when you click Open, PC-DMIS gives V1 the full pathway to the selected file. The rest of the program deletes the selected file.