Solved

CommonDialog1.Filter

Posted on 2000-03-14
7
260 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

691 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