Solved

CommonDialog1.Filter

Posted on 2000-03-14
7
242 Views
Last Modified: 2011-09-20
Hi,

Floowing code can not work. Please correct it.

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

(VB5)
0
Comment
Question by:victorlong
  • 3
  • 2
  • 2
7 Comments
 
LVL 14

Accepted Solution

by:
mcrider earned 45 total points
ID: 2616295
I think you mean this:


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



Cheers!®©
0
 

Author Comment

by:victorlong
ID: 2616351
Adjusted points from 35 to 45
0
 

Author Comment

by:victorlong
ID: 2616352
Hi mcrider,

Why  "(*.txt)|*.txt" can work, my "*.txt" looks nicer than yours :-)
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 3

Expert Comment

by:paulstamp
ID: 2616374
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
 

Author Comment

by:victorlong
ID: 2620542
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
 
LVL 14

Expert Comment

by:mcrider
ID: 2621727
Thanks for the points!


Cheers!®©
0
 
LVL 3

Expert Comment

by:paulstamp
ID: 2622616
victorlong - no problem... I just saw your request for clarification hadnt been answered yet. Happy to help
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now