Results 1 to 8 of 8

Thread: Using filters in Common Dialog boxes

  1. #1
    nottheboss
    Guest

    Question Using filters in Common Dialog boxes

    I want the user only see the files with .edl extension only when browsing.

    I have set the properties for defaultext and filter to *.edl but it still shows everything. (*.edl shows up in the CommonDialog box in the Files of Type window.... but that's it)

    Can someone help?

    Thanks,
    Eric

  2. #2
    Addicted Member
    Join Date
    Sep 1999
    Posts
    229
    Hi nottheboss,

    Try this out:

    Me.CommonDialog1.Filter = "EDL (*.edl)|*.edl"
    Me.CommonDialog1.ShowOpen

    Hope it helps
    Keiko

  3. #3
    nottheboss
    Guest

    Unhappy

    Where in my code do I Put that? I tried it in a couple of places and it seems to have no effect.

    BTW, it is CommonDialog1 so that's not the problem.

    Does my filterindex property have anything to do with it?

  4. #4
    Addicted Member
    Join Date
    Sep 1999
    Posts
    229
    Hi nottheboss,

    You should place it in the procedure that fires the Dialog Box.

    e.g:

    Private Sub cmdOpenDialog_Click()

    Me.CommonDialog1.Filter = "EDL (*.edl)|*.edl"
    Me.CommonDialog1.ShowOpen

    End Sub

    Hope it helps
    Keiko

  5. #5
    nottheboss
    Guest
    Got it. Great. Works like a charm.

    Thanks Keiko!!!

  6. #6
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    You can also set the Filter property at design-time.
    But you have to follow the syntax:
    Code:
    Text to show|Filter1|Other text|Filter2
    EDL files|*.edl|All Files|*.*
    Best regards

  7. #7
    Also, you can use the FilterIndex property (set it to 0) to select the first filter by default. Also it is good practice as Joacim showed to always include the option to select any type of file.
    Last edited by filburt1; Dec 27th, 2001 at 11:24 PM.

  8. #8
    nottheboss
    Guest
    Thanks for the added tips.

    The All Files is an important one and something I overlooked.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width