Solved

CommonDialog1.Filter

Posted on 2000-03-14
7
244 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Vb.net 2008 2 60
VBA to copy paste columns form one file to other 20 88
Run code from text file in vb 1 65
how to Classify of email (pdf attachments) 7 36
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

809 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