.NET Questions (CLOSED)

Questions and Answers on any aspect of .NET. Now closed.

This discussion group is now closed.

Have a question about .NET development? Try stackoverflow.com, a worldwide community of great developers asking and answering questions 24 hours a day.

The archives of .NET Questions contain years of Q&A. Even older .NET Questions are still online, too.

File save dialog and DefaultExt

I have a file save dialog, and I'm trying to set the DefaultExt to be the last extension that the user saved a file as, to make saving multiple files easier.

It doesn't seem to work at all.  I can set it to "txt" or ".txt", and even though the extension is in the filter string, they just don't take.  It always selects the first extension in the list.
John Cromartie Send private email
Thursday, November 08, 2007
 
 
IIRC , the default extension string takes a special format of "<file extension description>|<file ext>" for example "text files|*.txt"
Miki Watts Send private email
Thursday, November 08, 2007
 
 
The MSDN Library page for FileDialog.DefaultExt speaks thusly:

"By default, the AddExtension property attempts to determine the extension to filter the displayed file list from the Filter property. If the extension cannot be determined from the Filter property, DefaultExt will be used instead."

That sounds as if DefaultExt is simply ignored when a Filter element is already selected.  Try setting FilterIndex instead, or along with DefaultExt.
Chris Nahr
Saturday, November 10, 2007
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz