VB Code:
'string array sample
Dim strFiles() as String
'For example we will fill strFiles() in the forms' load event
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
strFiles = IO.Directory.GetFiles("c:", "*.*")
'Lets Display the list of files for fun....
For I As Integer = 0 To strFiles.GetUpperBound(0)
MsgBox(strFiles(I))
Next
End Sub
VB Code:
'Example using a collection...
Dim colFiles as New Collection
'Again we will use the form load event...
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
x = New Collection ' remove all previous data (really not needed here)
Dim strFiles() As String = IO.Directory.GetFiles("c:\", "*.*")
For I As Integer = 0 To strFiles.GetUpperBound(0)
x.Add(strFiles(I))
Next
'now read the files from the collection
For y As Integer = 1 To x.Count
MsgBox(CType(x.Item(y), String))
Next
End Sub