|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Commondialog1.FilterI'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! 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! > Thanks for your suggestion. I tried setting the filter too as you
mentioned. But doesn't help either. 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! "Joy2006" <shubh***@gmail.com> wrote in message fwiw, That is called the Pipe character.news:1142980852.891098.9650@i39g2000cwa.googlegroups.com... > Thanks a lot. This works now. I was missing the (shift + backslash.) > -- Ken Halter - MS-MVP-VB - Please keep all discussions in the groups.. DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm |
|||||||||||||||||||||||