在我的搜索中获取文件 [英] Get Files In My Search

查看:59
本文介绍了在我的搜索中获取文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,每个人
我要搜索具有扩展名(任何扩展名)的文件
问题是我无法搜索我选择的任何驱动器的文件,
这就是代码.

Hello, every one
I want to search for files Have Extension (Any Extension)
The Problem is I can''t Search for files any Drive I chosen,
This IS The Code.

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

推荐答案

您是否尝试过 Directory.GetFiles [

在最后的代码中,将其压缩为msg错误出现在我身上
像这样
此处
In the last code When excut it msg error appear to me
like this
Here


这篇关于在我的搜索中获取文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆