vs2008 de alt klasörleri listeleme

  • Konbuyu başlatan Konbuyu başlatan DotCom
  • Başlangıç tarihi Başlangıç tarihi
Kodla Büyü

DotCom

Hiperaktif Üye
Hiperaktif
Mesajlar
2,930
Merhaba ,

Textboxa gireceğim klasördeki dosya ve dizinleri alt dizinlerdeki dahil , listbox'a listemeye çalışıyorum.
Imports System.IO
Imports System.Collections
Imports System.Linq
Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim dirPath As String = TextBox1.Text
For Each entry As String In Directory.GetFiles(dirPath)
DisplayFileSystemInfoAttributes(New DirectoryInfo(entry))
ListBox2.Items.Add(entry)

Next
' Loop through all the files in C.
For Each entry As String In Directory.GetFiles(dirPath)
DisplayFileSystemInfoAttributes(New FileInfo(entry))
Next
End Sub

Sub DisplayFileSystemInfoAttributes(ByVal fsi As IO.FileSystemInfo)
' Assume that this entry is a file.
Dim entryType As String = "File"

' Determine if this entry is really a directory.
If (fsi.Attributes And FileAttributes.Directory) = FileAttributes.Directory Then
entryType = "Directory"
End If

ListBox1.Items.Add(fsi.FullName)

' Show this entry's type, name, and creation date.
Console.WriteLine("{0} entry {1} was created on {2:D}", _
entryType, fsi.FullName, fsi.CreationTime)

End Sub

End Class

Kodlarımız bu şekilde. Textboxa girilen yoldaki klasörleri listbox1e , dosyaları ise listbox2 ye listeliyor.

Yaptırmaya çalıştığım işlem alt klasörleri de bu işleme dahil edebilmek?
Ne önerirsiniz?
 
BBNET
Geri
Üst