RSS Forums RSS
Please support our VB.NET advertiser: Programming Forums
Views: 679 | Replies: 3 | Solved | Thread Tools  Display Modes
Reply
Join Date: Aug 2006
Location: me::house
Posts: 908
Reputation: linux is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 23
linux's Avatar
linux linux is offline Offline
Posting Shark

Filling listbox with files in a directory

  #1  
Jul 22nd, 2008
I want to add a list box onto a form, and have it (once the form loads), it'll list all of the files in C:\WINDOWS\ . Is there any easy way to accomplish this?
Toshiba M1151.49 GB DDR-2 RAM1.6 GHz Centrino Duo80GB HDDWindows XP Media Center Edition
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2006
Location: Argentina
Posts: 51
Reputation: dmf1978 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 7
dmf1978's Avatar
dmf1978 dmf1978 is offline Offline
Junior Poster in Training

Re: Filling listbox with files in a directory

  #2  
Jul 22nd, 2008
Hi,
Try this
  1. Dim folderInfo As New IO.DirectoryInfo("c:\windows")
  2. Dim arrFilesInFolder() As IO.FileInfo
  3. Dim fileInFolder As IO.FileInfo
  4.  
  5. arrFilesInFolder = folderInfo.GetFiles("*.*")
  6. For Each fileInFolder In arrFilesInFolder
  7. ListBox1.Items.Add(fileInFolder.Name)
  8. Next
Hope it helps
-- Martín
Reply With Quote  
Join Date: Aug 2006
Location: me::house
Posts: 908
Reputation: linux is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 23
linux's Avatar
linux linux is offline Offline
Posting Shark

Re: Filling listbox with files in a directory

  #3  
Jul 22nd, 2008
Thanks. That worked nicely.

Can you also help me with how to make a progressbar that would update with a timer, thatd do 1% every .5 seconds? Also when the form loads.
Toshiba M1151.49 GB DDR-2 RAM1.6 GHz Centrino Duo80GB HDDWindows XP Media Center Edition
Reply With Quote  
Join Date: Aug 2006
Location: me::house
Posts: 908
Reputation: linux is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 23
linux's Avatar
linux linux is offline Offline
Posting Shark

Re: Filling listbox with files in a directory

  #4  
Jul 22nd, 2008
Never mind, I figured it out!
Toshiba M1151.49 GB DDR-2 RAM1.6 GHz Centrino Duo80GB HDDWindows XP Media Center Edition
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Other Threads in the VB.NET Forum
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 5:46 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC