We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

File Load restricted to C# files

Thread ID:





34013 Aug 31,2005 10:04 AM UTC Sep 19,2005 10:32 PM UTC WinForms 2
Tags: EditControl
Brian Saunders
Asked On August 31, 2005 10:04 AM UTC

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

Administrator [Syncfusion]
Replied On 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.

Administrator [Syncfusion]
Replied On 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.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon