FileDialog.Filter hide extensions

Hiding file extensions in FileDialog.Filter

Page 1 of 1

8 Replies - 11127 Views - Last Post: 09 June 2008 - 02:38 PM Rate Topic: -----

#1 kickit2  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 08-June 08

FileDialog.Filter hide extensions

Posted 08 June 2008 - 03:30 PM

Is it possible to hide the file extension when using FileDialog.Filter
I wish to have the filters set to three values:

"All Supported Audio"
"MP3s"
"WMAs"

^ I wish that to be all that there is in the filter drop down box.
What Im getting now is:
"All Supported Audio (*.mp3;*.wma)"
"MP3s (*.mp3)"
"WMAs (*.wma)"

Basicly just get rid of having the actual file extension in the drop down box and just the text..

Any ideas?

Is This A Good Question/Topic? 0
  • +

Replies To: FileDialog.Filter hide extensions

#2 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: FileDialog.Filter hide extensions

Posted 08 June 2008 - 04:11 PM

Remove the "(*.xxx)" from the Filter string.

openFileDialog1.Filter = "All Supported Audio | *.mp3; *.wma | MP3s | *.mp3 | WMAs | *.wma";

Was This Post Helpful? 0
  • +
  • -

#3 kickit2  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 08-June 08

Re: FileDialog.Filter hide extensions

Posted 08 June 2008 - 04:31 PM

View Postjayman9, on 8 Jun, 2008 - 04:11 PM, said:

Remove the "(*.xxx)" from the Filter string.

openFileDialog1.Filter = "All Supported Audio | *.mp3; *.wma | MP3s | *.mp3 | WMAs | *.wma";


I already have my code exactly like that...

below is my code

-----------------------------------------------------------------------------------
			OpenFileDialog fl_dlg = new OpenFileDialog();
			fl_dlg.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
			fl_dlg.Title = "Select File(s)";
			fl_dlg.Filter = "All Supported Audio | *.mp3; *.wma | MP3s | *.mp3 | WMAs | *.wma";
			fl_dlg.Multiselect = true;
			DialogResult fl_dlg_result = new DialogResult();
			ArrayList file_arraylist = new ArrayList();
			fl_dlg_result = fl_dlg.ShowDialog();


-----------------------------------------------------------------------------------

I posted a picture of the window it makes at http://i306.photobuc.../FileDialog.jpg
Was This Post Helpful? 0
  • +
  • -

#4 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1524
  • View blog
  • Posts: 5,957
  • Joined: 21-March 08

Re: FileDialog.Filter hide extensions

Posted 08 June 2008 - 04:59 PM

edited

This post has been edited by eclipsed4utoo: 08 June 2008 - 05:00 PM

Was This Post Helpful? 0
  • +
  • -

#5 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: FileDialog.Filter hide extensions

Posted 08 June 2008 - 05:04 PM

It shows up exactly as you described it in my project. Does it still not show the drop down items that way you want it to in your project?

Is this not how you wanted it?

Attached image(s)

  • Attached Image

Was This Post Helpful? 0
  • +
  • -

#6 kickit2  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 08-June 08

Re: FileDialog.Filter hide extensions

Posted 08 June 2008 - 05:16 PM

View Postjayman9, on 8 Jun, 2008 - 05:04 PM, said:

It shows up exactly as you described it in my project. Does it still not show the drop down items that way you want it to in your project?

Is this not how you wanted it?


The way you have yours is EXACTLY the way I would like it.. I wonder if this is just a Vista issue.. Unfortunatly
this needs to be able to run under vista as well...

The link that I provided above is the way it looks under Vista.

SOO... seems this becomes a Vista issue - Any ideas to over-ride this?

EDIT: Even M$'s page shows that this code should work..
http://msdn.microsof...log.filter.aspx (the window in the demo is from Vista)

This post has been edited by kickit2: 08 June 2008 - 05:20 PM

Was This Post Helpful? 0
  • +
  • -

#7 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: FileDialog.Filter hide extensions

Posted 08 June 2008 - 06:50 PM

Hmm..it sounds like there is definitely something going on here. It should be working.

Can you post the code that you are using?
Was This Post Helpful? 0
  • +
  • -

#8 kickit2  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 08-June 08

Re: FileDialog.Filter hide extensions

Posted 08 June 2008 - 07:27 PM

View Postjayman9, on 8 Jun, 2008 - 06:50 PM, said:

Hmm..it sounds like there is definitely something going on here. It should be working.

Can you post the code that you are using?


Repost of code from above:
			OpenFileDialog fl_dlg = new OpenFileDialog();
			fl_dlg.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
			fl_dlg.Title = "Select File(s)";
			fl_dlg.Filter = "All Supported Audio | *.mp3; *.wma | MP3s | *.mp3 | WMAs | *.wma";
			fl_dlg.Multiselect = true;
			DialogResult fl_dlg_result = new DialogResult();
			ArrayList file_arraylist = new ArrayList();
			fl_dlg_result = fl_dlg.ShowDialog();



If you need more - let me know.. Ill send you the whole damn project if you feel it would help..
Thanks.
Was This Post Helpful? 0
  • +
  • -

#9 kickit2  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 08-June 08

Re: FileDialog.Filter hide extensions

Posted 09 June 2008 - 02:38 PM

Fixed it. Using FileDialog.AutoUpgradeEnabled = false it will display the old XP sytle dialog box, which then displays correctly

			OpenFileDialog fl_dlg = new OpenFileDialog();
			fl_dlg.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
			fl_dlg.Title = "Select File(s)";
			fl_dlg.Filter = "All Supported Audio | *.mp3; *.wma | MP3s | *.mp3 | WMAs | *.wma";
			fl_dlg.AutoUpgradeEnabled = false; //<-------THIS LINE HERE DOES THE TRICK!!!
			fl_dlg.Multiselect = true;
			DialogResult fl_dlg_result = new DialogResult();
			ArrayList file_arraylist = new ArrayList();



Hope this helps someone in the future!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1