Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...