Is there an alternate to the VS2005Getfiles that will return a string array.

In my old code I declared a variable _fileList() as string. Then I usedDirectory.GetFiles(strDefaultDirectory,"IP*") to fill the array. Now the getfiles function us nder the My .namespace "My.Computer.FileSystem.GetFiles" and returns this "System.Collections.ObjectModel.ReadOnlyCollection(OfString)"

Previoulsy if the directory.getFiles method returned 0 items I would used the ".Filenames" property of a OpenFileDialog box to return my array of names. This still works the same. But now I can share one variable for either process which in my mind they would both use the same internal code to return a listing of files.

Is there a new 2005 Openfiledialog box that returns a collection of strings instead of an array? I tinkered with CType do try to convert the string to a collection but haven't had any success with it.

[1118 byte] By [PhillipPutzback] at [2007-12-16]
# 1

That's a good suggestion, but there's nothing that exists today for that. You can convert easily from a readonly collection to a string array by doing code similar to this:



Dim o as ReadOnlyCollection 'Your return value
Dim _filelist(o.count -1) as string
o.copyto(_filelist,0)

Toddap_MS

Toddap at 2007-9-9 > top of Msdn Tech,Visual Basic,Visual Basic Language...