OpenFileDialog

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi everyone,

when you open a file using the OpenFileDialog control, there is normally a
combobox at the bottom of the dialogbox. it says, for example, HTML documents
(*.html;*.htm)
All files (*.*)

How do you get a second option in that combobox? i really NEED to know or my
boss will slaughter me!
 
Hello,

You can do it with setting Filters properties, like that:

dlg.Filters = "HTML documents (*.html)|*.html|XML documents
(*.xml)|*.xml|All files (*.*)|*.*";
 
Alvo,

Check out the documentation for the FilterIndex property on the
OpenFileDialog class. It shows you how to set the filter for the files, as
well as the index for the filter when the dialog is open.

Hope this helps.
 
hi,

thanks for the help. it worked. you've saved my life

--
Alvo von Cossel I of Germany


Nicholas Paldino said:
Alvo,

Check out the documentation for the FilterIndex property on the
OpenFileDialog class. It shows you how to set the filter for the files, as
well as the index for the filter when the dialog is open.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Alvo von Cossel I said:
hi everyone,

when you open a file using the OpenFileDialog control, there is normally a
combobox at the bottom of the dialogbox. it says, for example, HTML
documents
(*.html;*.htm)
All files (*.*)

How do you get a second option in that combobox? i really NEED to know or
my
boss will slaughter me!
 
Back
Top