Hi all
OK, I didn't want to ask this 'cos I know the answer's going to be way too easy, but I've struggled with it for long enough really and I can't get to grips with it.
I found the code below on the internet. It lists all the files at a given location in ListBox1, and it works realy well, except I don't want the files in a listbox, I want them in an array, and I just can't manage it for some reason. I also tried MsgBox'ing dra from within the loop to see if it would report but it won't.
What am I doing wrong?
DominicB
OK, I didn't want to ask this 'cos I know the answer's going to be way too easy, but I've struggled with it for long enough really and I can't get to grips with it.
I found the code below on the internet. It lists all the files at a given location in ListBox1, and it works realy well, except I don't want the files in a listbox, I want them in an array, and I just can't manage it for some reason. I also tried MsgBox'ing dra from within the loop to see if it would report but it won't.
What am I doing wrong?
VB.NET:
' make a reference to a directory
Dim di As New IO.DirectoryInfo("c:\")
Dim diar1 As IO.FileInfo() = di.GetFiles()
Dim dra As IO.FileInfo
'list the names of all files in the specified directory
For Each dra In diar1
ListBox1.Items.Add(dra)
Next dra
DominicB