Home All Groups Group Topic Archive Search About
Author
21 Mar 2006 1:36 PM
Joy2006
I'm using VB6 and am not sure why this doesn't work at all.

Commondialog1.Filter '"Text Files (*.txt)"

I have added this in every place possible and this is the only
functionality that doens't seem to work. Rest of the functionality
related to commondialog1 seems to work!
I can see the filter correclty in the File| Open dialog, however, it
doesn't filter out the files and I see files with all types of
extensions, like doc, pdf etc.
Any idea what's going on here?

Thanks!

Author
21 Mar 2006 1:41 PM
Robert
You need to set the FilterIndex property as well. Should be 1 in your case.

Hope that helps

Robert

Show quoteHide quote
"Joy2006" <shubh***@gmail.com> wrote in message
news:1142948199.750371.317080@i40g2000cwc.googlegroups.com...
> I'm using VB6 and am not sure why this doesn't work at all.
>
> Commondialog1.Filter '"Text Files (*.txt)"
>
> I have added this in every place possible and this is the only
> functionality that doens't seem to work. Rest of the functionality
> related to commondialog1 seems to work!
> I can see the filter correclty in the File| Open dialog, however, it
> doesn't filter out the files and I see files with all types of
> extensions, like doc, pdf etc.
> Any idea what's going on here?
>
> Thanks!
>
Author
21 Mar 2006 2:02 PM
Joy2006
Thanks for your suggestion. I tried setting the filter too as you
mentioned. But doesn't help either.
Author
21 Mar 2006 2:06 PM
ChaosTheEternal
You have to specify the filter to know which file types as well.  The
separator for the filter is the | (shift + backslash), so what you want
is something like:

CommonDialog1.Filter = "Text Files (*.txt)|*.txt"

And if you need to have multiple filters for types, just put a | after
the type value and continue on, like:

CommonDialog1.Filter = "Text Files (*.txt)|*.txt|Word Documents
(*.doc)|*.doc|Rich Text Files (*.rtf)|*.rtf|All Files|*.*"

Hope that helps
Joy2006 wrote:
Show quoteHide quote
> I'm using VB6 and am not sure why this doesn't work at all.
>
> Commondialog1.Filter '"Text Files (*.txt)"
>
> I have added this in every place possible and this is the only
> functionality that doens't seem to work. Rest of the functionality
> related to commondialog1 seems to work!
> I can see the filter correclty in the File| Open dialog, however, it
> doesn't filter out the files and I see files with all types of
> extensions, like doc, pdf etc.
> Any idea what's going on here?
>
> Thanks!
Author
21 Mar 2006 10:40 PM
Joy2006
Thanks a lot. This works now. I was missing the (shift + backslash.)
Author
21 Mar 2006 10:45 PM
Ken Halter
"Joy2006" <shubh***@gmail.com> wrote in message
news:1142980852.891098.9650@i39g2000cwa.googlegroups.com...
> Thanks a lot. This works now. I was missing the (shift + backslash.)
>

fwiw, That is called the Pipe character.

--
Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm