How do you get the contents of sertain folders to show in a ListBox?

Hello.

Can any one tell me how to get the contents

of the History folder to show in a LiskBox

when ya click a button, and the same with the

Temoprary Internet Files folder?

Aslo, how do you get the ListBox to clear and

only show the contents of the folder selected when ya

click the Button, and the contents of all the folders

showing in the LiskBox.

Am an absolute beginner, only started learning

2 weeks agao, any help will be very much

apreciated.

Thank you.

[541 byte] By [chris441962] at [2007-12-27]
# 1

To get a list of files from a folder into a listbox

Example using databinding

Dim s As String() = System.IO.Directory.GetFiles("C:\")
Me.ListBox1.DataSource = s

Or you can manually iterate through the array using

for each i as string in s
Me.Listbox.items.add(i)
next

Then to clear then either

me.listbox1.datasource = nothing

or

me.listbox1.items.clear

All you would need to do is set the path to whatever folder you want.

spotty at 2007-9-3 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...
# 2

im pretty sure I answered this question before

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=984031&SiteID=1

ahmedilyas at 2007-9-3 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...
# 3

Thanx Spotty,

Al give it a go.

Thank you.

chris441962 at 2007-9-3 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...
# 4

Hello Spotty.

I tried it but am still having problems.

All the files in the Cookies folder show in the ListBox.

But, regarding the files in the History folder and

Temorary Internet Files folder, nothing shows at all.

Sorry for troubleing you again.

I'm an absolute beginer, only started learning programming 2 weeks againg.

Thanx,

Much apresiated.

chris441962 at 2007-9-3 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...