Results 1 to 19 of 19

Thread: XP-Style Search

  1. #1

    Thread Starter
    Registered User
    Join Date
    Jun 2005
    Posts
    87

    XP-Style Search

    How do I search a folder for a file?

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: XP-Style Search

    VB Code:
    1. Private Sub Command1_Click()
    2. If Dir$("c:\autoexec.bat") <> vbNullString Then
    3.    MsgBox "file exists"
    4. Else
    5.    MsgBox "file doesn't exist"
    6. End If
    7. End Sub

  3. #3
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: XP-Style Search

    Hack,

    i just forgot one thing, how can i search for multiple files within a folder?
    Show Appreciation. Rate Posts.

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: XP-Style Search

    Quote Originally Posted by Harsh Gupta
    Hack,

    i just forgot one thing, how can i search for multiple files within a folder?
    VB Code:
    1. If Dir("c:\*.txt") <> vbNullString Then
    2.    MsgBox "Text files are in the root directory"
    3. Else
    4.    MsgBox "No such file types exist"
    5. End If

  5. #5
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: XP-Style Search

    my bad Hack, didn't post what exactly i wanted to ask.

    if i am searching for text files within a folder (and its subfolder), i want to create a list of all text files, probably in a listbox showing their names. how can i do that?
    Show Appreciation. Rate Posts.

  6. #6

    Thread Starter
    Registered User
    Join Date
    Jun 2005
    Posts
    87

    Re: XP-Style Search

    Thanks Hack... Is it possible to add a reference that allows me to utilize an F3 thype search?

  7. #7
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: XP-Style Search

    Quote Originally Posted by Harsh Gupta
    my bad Hack, didn't post what exactly i wanted to ask.

    if i am searching for text files within a folder (and its subfolder), i want to create a list of all text files, probably in a listbox showing their names. how can i do that?
    VB Code:
    1. Private Sub Command1_Click()
    2. Dim strFiles As String
    3. strFiles = Dir("d:\*.txt")
    4. Do While strFiles > ""
    5.    List1.AddItem strFiles
    6.    strFiles = Dir
    7. Loop
    8. End Sub

  8. #8
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: XP-Style Search

    Quote Originally Posted by stealth black
    Thanks Hack... Is it possible to add a reference that allows me to utilize an F3 thype search?
    What do you mean by an "F3 type search"?

  9. #9
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: XP-Style Search

    Thanks Hack.
    Quote Originally Posted by Hack
    What do you mean by an "F3 type search"?
    he means that whenever user presses F3, it must trigger the Search button. i believe that F3 is a common Shortcut for searching, in Windows.
    Show Appreciation. Rate Posts.

  10. #10
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: XP-Style Search

    Quote Originally Posted by Harsh Gupta
    Thanks Hack.

    he means that whenever user presses F3, it must trigger the Search button. i believe that F3 is a common Shortcut for searching, in Windows.
    Gotcha. Set the Form's KeyPreview property to True, and play around with this.
    VB Code:
    1. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    2. If KeyCode = vbKeyF3 Then
    3.    'run search code
    4. End If
    5. End Sub

  11. #11

    Thread Starter
    Registered User
    Join Date
    Jun 2005
    Posts
    87

    Re: XP-Style Search

    Ok... Do you know what the code is for the search companion?

  12. #12
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: XP-Style Search

    Quote Originally Posted by stealth black
    Ok... Do you know what the code is for the search companion?
    Search companion?

  13. #13

    Thread Starter
    Registered User
    Join Date
    Jun 2005
    Posts
    87

    Re: XP-Style Search

    Ok, in XP, when you are in any folder brower, you press F3 and you get the search feature in the left pane. (You know, the dog, the magician, etc...) I'm building a resource locator for the customer service reps here, to bring all the crap they use in a day together. I am wanting it to be an XP style search for various PDFs and image file I have created for them....

  14. #14
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: XP-Style Search

    I think the panels are COM components, but might be mistaken.

  15. #15

    Thread Starter
    Registered User
    Join Date
    Jun 2005
    Posts
    87

    Re: XP-Style Search

    Hmm, like the Microsoft Common references?

  16. #16
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: XP-Style Search

    Not really... Do you know what they are called? Because I have clean forgotten. Is it "Explorer Panes" or "Explorer Bars" ?

  17. #17
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: XP-Style Search

    Well I don't know how you'd even start to go about implementing the shell ones in your own application (I looked a bit and found nothing), but if you feel like creating your own with a similar feel, vbAccelerator has an XP-style Explorer Bar control here.

  18. #18

    Thread Starter
    Registered User
    Join Date
    Jun 2005
    Posts
    87

    Re: XP-Style Search

    Hey wait a minute! This is exactly what I need!

    Too cool! Thanks

  19. #19
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: XP-Style Search

    No problem, glad it helped

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