Does anyone know how to convert a ReadOnlyCollection into a regular Collection? And can Collections be stored in arrays?
The reason I'm doing this is that I'm trying to have a textbox which displays a list of saved games. I have the names of the saved games I want saved in "C:\SavedGames\(name-of-game)\Name.txt. So say a person has 3 saved games, A, B, and C. I want to combine "C:\SavedGames\A\Name.txt", "C:\SavedGames\B\Name.txt", and "C:\SavedGames\C\Name.txt" into a string, and display that string in the textbox. So I have the program search for "C:\SavedGames\*" (the directories) and then it saves them as a ReadOnlyCollection(Of String) named directories. What I want to do is take all "C:\SavedGames\(names-of-directories-found)\Name.txt" files and combine them into one string. I hope I'm not being confusing... Here's some code:
Dim directories As ReadOnlyCollection(Of String) directories = My.Computer.FileSystem.GetDirectories("C:\SavedGames\", True, "*") Dim files As ReadOnlyCollection(Of String) files = My.Computer.FileSystem.GetFiles("C:\SavedGames\" & directories, True, "\Name.txt") Dim filearray() As String ReDim filearray(files.count) filearray(0) = String.Concat(files) Dim filelist As String filelist = String.Join(vbCrLf, filearray) TextBox1.Text = filelist
The only error is in the line "files = My.Computer.FileSystem.GetFiles("C:\SavedGames\" & directories, True, "\Name.txt")". It says "Operator '&' is not defined for types 'String' and 'System.Collections.ObjectModel.ReadOnlyCollection(Of String)'."
Please help in any way you can.
Edit: Also, one unrelated question. I know how to make things respond to clicks and double clicks, but is there anyway to make them respond to triple clicks?