Click to See Complete Forum and Search --> : Problem with Common Dialog Control


goddess_spanky
September 17th, 2001, 02:01 PM
I am having a problem using the Filter property of the common dialog control. When I try to add a filter, i get the following compile error "Invalid use of property"
Is there any reason for this? does the filter property have to be set in the Form_Load event?
This is what I have:

private Sub cmdOpenFile_Click()
on error resume next
CommonDialog1.Filter "FoxPro Programs (*.prg)|*.prg"
CommonDialog1.ShowOpen
me.txtFileName = CommonDialog1.FileName
me.lstPrgFiles.AddItem (CommonDialog1.FileName)
End Sub




Thanks!

~goddess
goddess_spanky@hotmail.com

Iouri
September 17th, 2001, 02:17 PM
The problem I believe is not in Filter but in the line
me.lstPrgFiles.AddItem (CommonDialog1.FileName)

if you use CommonDialog1.FileName
then you will get the message - invalid use of property

try the following

r = CommonDialog1.FileName

me.lstPrgFiles.AddItem r

Iouri Boutchkine
iouri@hotsheet.com

goddess_spanky
September 17th, 2001, 02:36 PM
I tried your suggestion, but I still get the same error on the filter property.
Is there anything else I can try?

~goddess
goddess_spanky@hotmail.com

michi
September 17th, 2001, 02:38 PM
Maybe it is just a type error. I found you missed '='.

CommonDialog1.Filter = "FoxPro Programs (*.prg)|*.prg"

Regards,

Michi

goddess_spanky
September 17th, 2001, 02:43 PM
Thanks! This worked great.

~goddess
goddess_spanky@hotmail.com