mike-wigan Posted October 14, 2005 Posted October 14, 2005 i have 3 controls Combobox (DriveList) Listbox (FoldersList) ListBox (FilesList) i just can not get the folders list and the files list box to fill with data not sure what i have done just have a look through the code there are no build errors or run errors all i get is the drives list box filling and thats it the others are empty Imports System.IO Imports Microsoft.Office Imports System.IO.Directory Imports System.Runtime.InteropServices Imports System.Threading 'file browser modern = Date.Now 'task.SelectedIndex = 2 E_Path = TextBox1 On Error Resume Next If DrivesList.Text = "" Then DrivesList.Items.Clear() ShowAllDrives() DrivesList.SelectedIndex = 0 Me.Text = Directory.GetCurrentDirectory Else DrivesList.Items.Clear() ShowAllDrives() DrivesList.Items.Insert(0, DrivesList.Text) DrivesList.SelectedIndex = 0 Me.Text = Directory.GetCurrentDirectory End If 'myProgress = ProgressBar1 'myProgress.Value = 0 'myProgresscopy = ProgressBar2 'myProgresscopy.Value = 0 'Artist_ComboBox.Items.Insert(0, "Artist <Do Not Change>") 'Album_ComboBox.Items.Insert(0, "Album <Do Not Change>") 'TrackName_ComboBox.Items.Insert(0, "Track Name <Do Not Change>") 'Year_ComboBox.Items.Insert(0, "Year <Do Not Change>") ' CreateMyToolTip() End Sub Sub ShowFilesInFolder() Dim file As String Dim i As Integer = 0 Dim FI As FileInfo FilesList.Items.Clear() For Each file In Directory.GetFiles(Directory.GetCurrentDirectory) i = i + 1 Next 'MyProgress.Maximum = i For Each file In Directory.GetFiles(Directory.GetCurrentDirectory) 'Try FI = New FileInfo(file) If InStr(LCase(FI.Name), "mp3") > 0 = True Or InStr(LCase(FI.Name), "ace") > 0 = True Or InStr(LCase(FI.Name), "zip") > 0 = True Or InStr(LCase(FI.Name), "rar") > 0 = True Then If Not FilesList.Items.Contains(FI.Name) = True Then FilesList.Items.Add(FI.Name) End If End If 'Catch : End Try 'If myProgress.Value < myProgress.Maximum Then 'myProgress.Value = myProgress.Value + 1 'End If Next End Sub Sub ShowAllDrives() On Error Resume Next Dim drives() As String drives = Directory.GetLogicalDrives Dim aDrive As String For Each aDrive In drives DrivesList.Items.Add(aDrive) Next End Sub Sub ShowFoldersInDrive(ByVal drive As String) Dim folders() As String Try folders = Directory.GetDirectories(drive) Catch End Try Dim fldr As String FoldersList.Items.Clear() FoldersList.Items.Insert(0, "..") Dim DI As DirectoryInfo For Each fldr In folders Try DI = New DirectoryInfo(fldr) FoldersList.Items.Add(DI.FullName) Catch End Try Next Try Directory.SetCurrentDirectory(drive) DrivesList.Text = Directory.GetCurrentDirectory & FoldersList.SelectedItem Me.Text = Directory.GetCurrentDirectory & " - [Karaoke]" Catch : MsgBox(Err.Description, MsgBoxStyle.Critical) : End Try End Sub Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.