I want to know how to filter out all files that are not txt files in the open dialog in c#. I have been playing with this for ages and had no joy.
Use the filter property: MSDN Filter
Here is a MSDN Walk through on how to Customize OpenFile Dialog
Here is an example:
openFileDialog.Filter = "Text|*.txt|All|*.*";
You can remove All if you dont want to give them an option to select other types of files:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With