.NET

.NET

Reply
Active Contributor
csharpbird
Posts: 34
Registered: ‎08-22-2005
Message 1 of 5 (505 Views)

How to set multiple file extension of the OpenFileDialg?

505 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
Basha Sk
Posts: 43
Registered: ‎11-07-2006
Message 2 of 5 (505 Views)

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
Message 3 of 5 (505 Views)

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
GlennR
Posts: 12
Registered: ‎11-22-2006
Message 4 of 5 (505 Views)

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
hoangvuminh
Posts: 11
Registered: ‎04-28-2011
Message 5 of 5 (368 Views)

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

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.