返回首页

您好,每一个
我要搜索文件有扩展(任何扩展)
问题是我不能搜索文件我选择的任何驱动器,
这是代码。


Public Class Form1

    Dim FileCount As Integer = 0

    Private Sub BtnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSearch.Click

        If Not CombxDrive.Text = Nothing Then

            ListBox1.Items.Clear()

            FileCount = 0

        End If

 



        For Each File In My.Computer.FileSystem.GetFiles(CombxDrive.Text, FileIO.SearchOption.SearchAllSubDirectories, Nothing)

            Dim Title As String = My.Computer.FileSystem.GetFileInfo(File).Name

            If Title.Contains(CombxDrive.Text) Then

                ListBox1.Items.Add(Title)

                FileCount = FileCount + 1

            End If

        Next

        LblFileFound.Text = FileCount And "FilesFound"

 



    End Sub

| salah3bdelfatah |标记Nischalke

回答