Results 1 to 2 of 2

Thread: Search Files on hardrive

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2008
    Posts
    96

    Search Files on hardrive

    I am using this code to get files, but I can not get it to search for all files on C: drive.
    How can I get it to show all files Like *.pdf of the drive in the list box

    Code:
    Imports System.IO
    Imports System
    Imports System.Drawing
    Imports System.Windows.Forms
     
    Public Class SearchAvi
     
        Private Sub BtnGetAviFiles_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnGetAviFiles.Click
     
            Dim dir1 As New IO.DirectoryInfo("c:")
            Dim dir2 As IO.FileInfo() = dir1.GetFiles()
            Dim files1 As IO.FileInfo
     
            For Each files1 In dir2
                FrmListBox.Items.Add(files1)
            Next
     
        End Sub

  2. #2
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,780

    Re: Search Files on hardrive

    Have a look at the help file for DirectoryInfo.GetFiles, it has options you can use for filter and folder selection.

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