Microsoft KB Archive/35715

= Multiple &quot;Can't Find: &quot; Prompts on Write-Protected Disk =

Article ID: 35715

Article Last Modified on 11/21/2006



This article was previously published under Q35715



SUMMARY
If an OPEN &quot;filename&quot; statement (with no explicit path) in a Macintosh QuickBASIC program cannot find a data file in the current default folder, it will prompt you to look for the data file with the following statement:

&quot;Can't find:. Would you like to look for it?&quot;

You can then click OK, change to the right folder, and open the needed file. The program now permanently remembers this new default folder. The next time that program OPENs a file, it looks in the new default folder.

However, if you run the program on a locked (write-protected) disk, the program cannot remember where you found the last file, and the &quot;Can't find...&quot; dialog always appears when your program attempts to OPEN a data file (with no explicit path) that is not in the current folder.

You can make the program automatically remember where you last found an OPENed data file by unlocking the floppy disk (by sliding the write-enable tab to close the hole).



MORE INFORMATION
In interpreted programs, the current folder defaults to the folder where QuickBASIC itself is running. In compiled programs, the current folder defaults to the folder where the compiled application is running.

You can use the CHDIR statement to change the current folder to the location of the data file(s). For example, CHDIR &quot;Volume:Folder1:&quot; makes all subsequent OPEN &quot;filename&quot; statements look in the folder called &quot;folder1&quot; on the disk volume called &quot;Volume&quot;.

Note: You can also specify full pathnames for data files (such as OPEN &quot;Volume:folder1:filexxx&quot;). Two disadvantages of this are that your program will not be able to find the file if it is moved somewhere else, and the new folder won't be remembered if found through the &quot;Can't Find File&quot; dialog.

You may find it more flexible to use OPEN statements without an explicit path, such as OPEN &quot;filename&quot;. Statements of this form use the default search path, and can remember a new path when run on write-enabled disks.

When you find an OPENed data file in response to the &quot;Can't Find: &quot; dialog, the location and the filename are automatically saved in an MBPN resource in the source file or compiled program only if the program is on a disk that is not write-protected or locked. The next time the program OPENs the data file, it uses the remembered location that was stored in its MBPN resource. Programs run on write-enabled disks need to prompt you only once to find files that haven't been found before.

If a program is run on a disk that is locked, or the program itself is locked, it cannot save an MBPN resource and, therefore, prompts you to look for data files that are not in the current folder at every OPEN statement. This is inconvenient, but harmless.

You may disable the &quot;Can't Find...&quot; processing by selecting the &quot;Disable File Not Found Dialog&quot; option in the Options... from the QuickBASIC Run menu. If this option is selected, then a run-time error &quot;53, File Not Found&quot;, occurs on the OPEN when a file cannot be found in the current folder or with the specified full path. This applies to both interpreted and compiled QuickBASIC programs.

Additional query words: MQuickB

Keywords: KB35715

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.