Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Files in a listbox
#1
I would first like to say thanks for putting up a website like this! I have looked through and watched your tutorial on having files come up in a listbox. I'm still having problems getting them to show up though....I'm a newbie to all of this. This is the code I'm using below, but when I run the project I don't see any files in the listbox.....thanks for the help in advance!!


Public Class Form3

Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Dim directory = "C:\PIF"
Dim files() As System.IO.FileInfo
Dim dirinfo As New System.IO.DirectoryInfo(directory)
files = dirinfo.GetFiles("*", IO.SearchOption.AllDirectories)
For Each file In files
ListBox1.Items.Add(file)
Next
End Sub
End Class


Messages In This Thread
Files in a listbox - by Hurricane - 02-26-2012, 08:45 AM
Re: Files in a listbox - by Hurricane - 02-26-2012, 07:39 PM
Re: Files in a listbox - by Hurricane - 02-26-2012, 07:48 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Listbox items text and text boxes? Derek275 3 16,324 11-21-2012, 12:04 PM
Last Post: brandonio21
  How to search multiple files for one string ryan 1 8,918 06-18-2012, 06:04 PM
Last Post: brandonio21
  How to delete all files in a specific folder using VB ? Himansh 4 16,729 03-13-2012, 02:55 PM
Last Post: brandonio21
  Get Files from the C drive Protection4Real 3 13,877 02-10-2011, 07:59 AM
Last Post: Protection4Real

Forum Jump:


Users browsing this thread: 1 Guest(s)