Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Show only certain extensions in Common Dialog Box

Posted on 2006-07-16
9
Medium Priority
?
190 Views
Last Modified: 2010-04-30
Hi Experts.

I have a common dialog box and want to open a file but I only want to show cetain file extensions ie. .jpg etc

Many Thanks
Lee
0
Comment
Question by:ljhodgett
[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
  • 4
  • 3
  • 2
9 Comments
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 17116983
Private Sub Command1_Click()
CommonDialog1.Filter = ".txt|text files|.doc|Doc files"
CommonDialog1.ShowOpen
End Sub
0
 
LVL 13

Expert Comment

by:iHadi
ID: 17117257
Hi ljhodgett
GrahamSkan post is wrong, the right code is :

Private Sub Command1_Click()
CommonDialog1.Filter = "text|*.txt files|Doc files|*.doc"
CommonDialog1.ShowOpen
End Sub
0
 
LVL 13

Accepted Solution

by:
iHadi earned 500 total points
ID: 17117258
Sorry this is the right code (printing error):

Private Sub Command1_Click()
CommonDialog1.Filter = "text files|*.txt |Doc files|*.doc"
CommonDialog1.ShowOpen
End Sub
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 17117652
iHadi,

>>GrahamSkan post is wrong<<
Please read this (especially if you are not prepared to test your code):
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/help.jsp#hi64

There should not be any space after the filespec, instead of:
CommonDialog1.Filter = "text files|*.txt |Doc files|*.doc"

It should be:
CommonDialog1.Filter = "text files|*.txt|Doc files|*.doc"
0
 
LVL 13

Expert Comment

by:iHadi
ID: 17118878
acperkins
I think as an expert, if you see a wrong solution, you should point it out so people who read this page do not get confused in trying out the solution and spend precious time in debuging it and trying to get it work. I did not use any bad or unappropriate words that could be descibed as critical comments.

As for the space issue you are right. It was a printing error, and by the way I did test the code but for the doc extention (the directory I browsed had no txt files) and I think one working extention is enough to deliver the idea. Thank you for pointing out this bug and I would not consider it criticizing!!!
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 17119448
>>I think as an expert, if you see a wrong solution, you should point it out so people who read this page do not get confused in trying out the solution and spend precious time in debuging it and trying to get it work<<

Perhaps.  But then at least test your solution before you post rather than posting a solution and look like an idiot when it does not do what you say it does.  Don't you agree?
0
 
LVL 13

Expert Comment

by:iHadi
ID: 17119611
>>Please read this (especially if you are not prepared to test your code):
>>http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/help.jsp#hi64

Now this is criticizing calling me an idiot. I will not reply to it but I wish Mr. jimhorn has something to say on this.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 17121956
We all make mistakes :).
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 17122687
iHadi,

>>Now this is criticizing calling me an idiot.<<
I realize English may not be your first language, so please re-read what I said, I did not say you were an idiot. But feel free to post a message in Community Support if you feel my comments are in any way inappropriate.  

Also, please re-read the following from the EE Guidelines:

Test your solution when appropriate
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/help.jsp#hi66
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

722 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