ofd.Filter = "pdf files (*.pdf)|*.*";
Why is it that it can still brownse non-pdf files? Is something wrong here?
The string is in two parts (FileDialog.Filter docs):
Label|Extension
Your label is pdf files (*.pdf)
, but the extension you are filtering by is *.*
. Try setting it to |*.pdf
instead.
In short, the *.pdf
you have specified is only a descriptive text. It could be anything. It is not used to filter.