Thursday, November 10, 2016

SEARCH FILES ; VB.NET


Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        sear(txtfilename.Text)

    End Sub

    Private Sub sear(ByVal item)
        Try


            Dim Folder As New IO.DirectoryInfo(txtlocation.Text)
            For Each File As IO.FileInfo In Folder.GetFiles(txtfilename.Text & txtfextension.Text, IO.SearchOption.AllDirectories)
                ListBox1.Items.Add(File.FullName)
                Application.DoEvents()
            Next

        Catch ex As Exception
            MessageBox.Show(ex.Message, "search")
        End Try

    End Sub

    
End Class

No comments: