4 Mayıs 2013 Cumartesi
Dosya Adı,Yolu Alt dizinleriyle Listeleme
Kodlarını ..........................................
İNDİR
Imports System.IO Public Class Form1 Dim a As New ArrayList Dim yol As New DirectoryInfo("C:\WINDOWS") Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click ''Dosya yolu ve adı On Error Resume Next For Each liste In yol.GetFiles("*.exe") Me.ListBox1.Items.Add(liste.FullName) Next End Sub Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click 'sadece Dosya adı listelenir ListBox1.DataSource = yol.GetFiles("*.exe") '("*.*") End Sub Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click ' '' ListBox1.DataSource = yol.GetFiles("*.exe") Bunu silmiyor hata veriyor ' (ListBox1.DataSource = Nothing) şeklinde olmalı On Error GoTo alt Me.ListBox1.Items.Clear() Exit Sub alt: ListBox1.DataSource = Nothing End Sub Public Sub adddirectory(ByVal subdir1 As String, ByVal subdir2 As String) Dim file() As String = System.IO.Directory.GetFiles(subdir1, subdir2) For Each files As String In file a.Add(files) Next For Each subdir As String In System.IO.Directory.GetDirectories(subdir1) If System.IO.Directory.GetFiles(subdir).Length <> 0 Then adddirectory(subdir, subdir2) End If Next End Sub Private Sub Button4_Click(sender As System.Object, e As System.EventArgs) Handles Button4.Click adddirectory("D:\MP3\MP3", "*.MP3") 'a.Clear() For i = 0 To a.Count - 1 ListBox1.Items.Add(a(i)) Next End Sub Private Sub Button5_Click(sender As System.Object, e As System.EventArgs) Handles Button5.Click Dim KlasorGosterFBD As New FolderBrowserDialog LblBaslamaDizini.Text = GetSetting(Application.ProductName, Application.ProductName, "Alt Klasör başlama yolu", "") KlasorGosterFBD.SelectedPath = LblBaslamaDizini.Text If (KlasorGosterFBD.ShowDialog() = DialogResult.OK) Then a.Clear() Windows.Forms.Cursor.Current = Cursors.AppStarting LblBaslamaDizini.Text = KlasorGosterFBD.SelectedPath Dim dsyAdi As String Dim uzanti As String = "*.mp3" a.Clear() adddirectory(LblBaslamaDizini.Text, uzanti) For z As Integer = 0 To a.Count - 1 dsyAdi = System.IO.Path.GetFileName(a(z)) ListBox1.Items.Add(Mid(dsyAdi, 1, Len(dsyAdi) - 4)) Next End If SaveSetting(Application.ProductName, Application.ProductName, "Alt Klasör başlama yolu", KlasorGosterFBD.SelectedPath) End Sub End Class
Sonraki Kayıt
Önceki Kayıt
Ana Sayfa