.NET

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

How to set multiple file extension of the OpenFileDialg?

525 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 (525 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 (525 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 (525 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 (388 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

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!