>It's a bug in a sample form. It sets filter incorrectly.
>Check also
Re: Descriptive File Types with PUTFILE() Thread #
574248Thank a million! The code below looks like a neat replacement for the usual getfile (or MS-OCX):
SET PATH TO "c:\program files\microsoft visual foxpro 9\ffc\" ADDITIVE
oCD = Newobject("_comdlg", "_system")
oCD.clearfilters(.T.)
oCD.AddFilter("Excel files (*.xls)", "*.xls")
oCD.AddFilter("Survey files (*.hrq)", "*.hrq")
* Dialog properties.
oCD.cTitlebarText = "Specify file name for output table"
* Initial defaults.
oCD.cFileName = "test.hrq"
oCD.cInitialDirectory = "c:\hroffice"
oCD.cDefaultExtension = "HRQ"
oCD.lSaveDialog = .t.
* Display the dialog and get results.
? oCD.showdialog()
It looks like a very basic error in the _system.AddFilter method (when the "list of Filters" was forced to cleared to nil...) prevented my code to work fine.
Here is the correction (for what it's worth):
IF EMPTY(THIS.aFilterList)
nNewRow = 1
ELSE
nNewRow = ALEN(THIS.aFilterList,1) + 1
ENDIF