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.
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.
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.