.NET

.NET

Reply
Active Contributor
34 Posts
0 Kudos
Registered: ‎08-22-2005
Post 1 of 5

How to set multiple file extension of the OpenFileDialg?

546 Views, 4 Replies
03-09-2007 08:52 PM
I can set the single file extension for Autodesk.AutoCAD.Windows.OpenFileDialg like this:
Autodesk.AutoCAD.Windows.OpenFileDialg dlg = new Autodesk.AutoCAD.Windows.OpenFileDialog("select files", null, "dwg", null, Autodesk.AutoCAD.Windows.OpenFileDialog.OpenFileDialogFlags.AllowMultiple);
But how to set set multiple file extension?
I have tried "dwg|dxf",but it does not work.
Active Contributor
43 Posts
0 Kudos
Registered: ‎11-07-2006
Post 2 of 5

Re: How to set multiple file extension of the OpenFileDialg?

03-09-2007 11:13 PM in reply to: csharpbird
Hello,
Give it a try......

OpenFileDialog Ofn = new OpenFileDialog();
Ofn.Filter = "C Sharp Files (*.cs)|*.cs|Text Files (*.txt)|*.txt";
Ofn.Title = "Type File";
Ofn.Multiselect = true;
Ofn.ShowDialog();

Best Regards,
Basha
*Kerry Brown
Post 3 of 5

Re: How to set multiple file extension of the OpenFileDialg?

03-10-2007 12:28 AM in reply to: csharpbird
For Multiple file extension options as you indicate, you could use :-
// using SWF = System.Windows.Forms;
// --
SWF.OpenFileDialog dlg = new SWF.OpenFileDialog();

dlg.Filter = "Drawing Based Files (*.dwg, *.dxf)|*.dwg;*.dxf";

dlg.Multiselect = true;

//kwb

wrote in message news:5514377@discussion.autodesk.com...
I can set the single file extension for
Autodesk.AutoCAD.Windows.OpenFileDialg like this:
Autodesk.AutoCAD.Windows.OpenFileDialg dlg = new
Autodesk.AutoCAD.Windows.OpenFileDialog("select files", null, "dwg", null,
Autodesk.AutoCAD.Windows.OpenFileDialog.OpenFileDialogFlags.AllowMultiple);
But how to set set multiple file extension?
I have tried "dwg|dxf",but it does not work.
Contributor
12 Posts
1 Kudo
Registered: ‎11-22-2006
Post 4 of 5

Re: How to set multiple file extension of the OpenFileDialg?

03-10-2007 04:56 PM in reply to: csharpbird
If you're using OpenFileDialog from Autocad, separate the extensions with semicolons eg. "dwg;dwt"
Contributor
11 Posts
0 Kudos
Registered: ‎04-28-2011
Post 5 of 5

Re: How to set multiple file extension of the OpenFileDialg?

05-23-2011 08:12 AM in reply to: GlennR

For example

 

Dim dlg As Autodesk.AutoCAD.Windows.OpenFileDialog = New Autodesk.AutoCAD.Windows.OpenFileDialog("Open Dat Files", "", "dat", "", 0)

 

Works like a Champ

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!