C
C#11mo ago
Tormenator1

✅ Utilizing the extension filter for openfiledialog

Hello. I'm attempting to use this
openFileDialog.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
openFileDialog.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
to filter for text files. However,I get an error that says 'OpenFileDialog' does not contain a definition for 'Filter' and no accessible extension method 'Filter' accepting a first argument of type 'OpenFileDialog' could be found (are you missing a using directive or an assembly reference?). I am on the newest version of the NET SDK,but I'm pretty sure that .Filter wasn't decapricated. What am i doing wrong?
1 Reply
Tormenator1
Tormenator1OP11mo ago
nevermind,figured it out
openFileDialog.Filters.Add(new FileFilter("Text files", ".txt", ".rtf"));
openFileDialog.Filters.Add(new FileFilter("Text files", ".txt", ".rtf"));
is how you can use this properly
Want results from more Discord servers?
Add your server