ljhodgett
asked on
Show only certain extensions in Common Dialog Box
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
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
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
GrahamSkan post is wrong, the right code is :
Private Sub Command1_Click()
CommonDialog1.Filter = "text|*.txt files|Doc files|*.doc"
CommonDialog1.ShowOpen
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
iHadi,
>>GrahamSkan post is wrong<<
Please read this (especially if you are not prepared to test your code):
https://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"
>>GrahamSkan post is wrong<<
Please read this (especially if you are not prepared to test your code):
https://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"
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!!!
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!!!
>>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?
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?
>>Please read this (especially if you are not prepared to test your code):
>>https://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.
>>https://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.
We all make mistakes :).
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
https://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/help.jsp#hi66
>>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
https://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/help.jsp#hi66
CommonDialog1.Filter = ".txt|text files|.doc|Doc files"
CommonDialog1.ShowOpen
End Sub