dcsimg
Results 1 to 3 of 3

Thread: OpenFileDialog Filter.

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2008
    Location
    Texas
    Posts
    1,288

    OpenFileDialog Filter.

    I have files that start with unique numbers and are word documents. Say the document starts with "1234567" is there a way to make the OpenFileDialog filter to where only all the .doc files that start with "1234567" show up?

    Thanks,

    Justin
    You down with OOP? Yeah you know me!
    MCAD and MCMICKEYMOUSE (vb.net)

    ----

    If it even kinda helps... rate it : )

    Edit a Multi-page .tif file and save.

  2. #2
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: OpenFileDialog Filter.

    You can modify the filter to only show the files you want to see:

    Code:
            Dim ofd As New OpenFileDialog
            ofd.Filter = "Docs(1*.doc)|1*.doc"
            If (ofd.ShowDialog() = DialogResult.OK) Then
                MessageBox.Show(ofd.FileName)
            End If

  3. #3
    Fanatic Member stlaural's Avatar
    Join Date
    Sep 2007
    Location
    Quebec, Canada
    Posts
    683

    Re: OpenFileDialog Filter.

    Have a look at the FileDialog.Filter Property.

    Personnaly I would simply try this and see if it works :
    Code:
    openFileDialog1.Filter = "Word files (1234567*.doc; 1234567*.docx)" ;
    Edit: Ahhh Negative was faster :P
    Alex
    .NET developer
    "No. Not even in the face of Armageddon. Never compromise." (Walter Kovacs/Rorschach)

    Things to consider before posting.
    Don't forget to rate the posts if they helped and mark thread as resolved when they are.


    .Net Regex Syntax (Scripting) | .Net Regex Language Element | .Net Regex Class | DateTime format | Framework 4.0: what's new
    My fresh new blog : writingthecode, even if I don't post much.

    System: Intel i7 920, Kingston SSDNow V100 64gig, HDD WD Caviar Black 1TB, External WD "My Book" 500GB, XFX Radeon 4890 XT 1GB, 12 GBs Tri-Channel RAM, 1x27" and 1x23" LCDs, Windows 10 x64, ]VS2015, Framework 3.5 and 4.0

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width