CommonDialog1.Filter

Hi,

Floowing code can not work. Please correct it.

    CommonDialog1.Filter = "*.txt"
    CommonDialog1.ShowOpen

(VB5)
victorlongAsked:
Who is Participating?
 
mcriderConnect With a Mentor Commented:
I think you mean this:


    CommonDialog1.Filter = "(*.txt)|*.txt"
    CommonDialog1.ShowOpen



Cheers!®©
0
 
victorlongAuthor Commented:
Adjusted points from 35 to 45
0
 
victorlongAuthor Commented:
Hi mcrider,

Why  "(*.txt)|*.txt" can work, my "*.txt" looks nicer than yours :-)
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
paulstampCommented:
The part before the separator is what gets displayed in the dialog box, what comes after is the filter actually used by the common dialog, thus the first part can be anything you like, ie it can be "Text files|*.txt". The important thing is you need to have both parts for the dialog to function.

You can also provide multiple options in the dropdown (like in Word or Excel) using these separators, ie

commondialog1.filter = "Word Files (*.doc)|*.doc|Text Files (*.txt)|*.txt"

This would produce a dropdown with Word Files (*.doc) and Text files (*.txt) as the options.
0
 
victorlongAuthor Commented:
Hi paulstamp,

Thank you so much for your comment that helps me understnd the format.

I still bive the points to mcrider, since he/she did answer my Q.

Cheers.
0
 
mcriderCommented:
Thanks for the points!


Cheers!®©
0
 
paulstampCommented:
victorlong - no problem... I just saw your request for clarification hadnt been answered yet. Happy to help
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.