|
-
Dec 6th, 1999, 07:45 AM
#1
Thread Starter
Lively Member
Hi,
How do I avoid showing all types of files in the Common Dialog control.
I tried setting the Filter property to "*.txt" at design time but all files in the directory will show up regardless of extensions.
Am I specifying the property wrong or is there another way to do it?
Thanks in advance.
-
Dec 6th, 1999, 07:54 AM
#2
Something like this should work for you:
Code:
MyForm.MyDialog.DefaultExt = "TXT"
MyForm.MyDialog.Filter = "Text Files(*.TXT)|*.TXT"
------------------
Marty
-
Dec 6th, 1999, 11:36 AM
#3
Member
Place a CommonDialog box on your form.
Open the code window for the Form procedure and add the following code.
Code:
Private Sub Form_Load()
'Setup common dialog box for open file type. Add filter
CommonDialog1.Filter = "Text Documents(*.txt)|*.txt"
CommonDialog1.DialogTitle = "Select a File to Load"
CommonDialog1.Action = 1 'Opem File type
End Sub
Hope this helps.
Ruchi
[This message has been edited by Ruchi (edited 12-06-1999).]
-
Dec 6th, 1999, 08:56 PM
#4
Member
Stick a common dialog control on your form together with a command button - double click on the button to get the code then enter:
--
Private Sub Command1_Click()
With CommonDialog1
.Filter = "Wav Files|*.wav"
If Err.Number = cdlCancel Then Exit Sub
MMControl1.FileName = .FileName
End With
End Sub
-- Hope this helps!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|