File Load restricted to C# files

When I use the LoadFile method, an Open File dialog appears that is filtered by by ''Default (*.*)''. I want to filter exclusively by C# files, i.e. show only those files that have a *.cs extension. Can I do this or must I invoke my own Open File dialog and read in the file manually? Likewise, when I use SaveAs I would like the filter to use ''*.cs'' to the exclusion of all other types. Thanks, Brian Saunders, WesternGeco

2 Replies

AD Administrator Syncfusion Team August 31, 2005 09:40 PM UTC

Hi Brian, I am afraid, this feature is currently not available in the EditControl. The Open and SaveAs dialogs in the current EditControl lets you load or save files of any extension or type respectively. However, this can be accomplished easily if you have source code by changing the Open and SaveAs methods in the FileEditControl class (in FileEditControl.cs file) as shown below (note that filter being set for C# files): public virtual void LoadFile() { m_openDialog.Filter = "C# Files (*.cs)|*.cs" ; DialogResult result = m_openDialog.ShowDialog( FindForm() as IWin32Window ); if( result == DialogResult.OK ) LoadFile( m_openDialog.FileName ); } public virtual bool SaveAs() { m_saveDialog.Filter = "C# Files (*.cs)|*.cs" ; DialogResult result = m_saveDialog.ShowDialog( FindForm() as IWin32Window ); if( result != DialogResult.OK ) return false; SaveFile( m_saveDialog.FileName ); return true; } We have also considered adding a bool property like FileFilterEnabled to the EditControl, which when set to true will filter files in SaveAs and Open file dialogs, i.e., it will display only those files that are associated with the currently loaded configuration settings and all others are filtered out. You could track the progress of this feature request at this link below : Feature Request #418 - Support for FileFilterEnabled property in the EditControl Let me know if you need any other information. We appreciate your patience and thanks for your interest in Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.


AD Administrator Syncfusion Team September 19, 2005 10:32 PM UTC

Hi Brian, Feature 418 has been implemented internally and the changes will be available in out post v3.3.0.0 releases. We have not added a FileFilterEnabled property, but have changed the default behavior of the Save/Load dialogs itself. We appreciate your continued interest in Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.

Loader.
Up arrow icon