Reputation: 20464
I need to do something like this:
Private Sub SearchInResources(ByVal PatternSTR As String)
For Each ResourceFile In My.Resources ' Obviously this don't works
If ResourceFile.EndsWith(".txt") Then
Dim fileContent As String = ResourceFile
Dim stringStream As New System.IO.StringReader(fileContent)
If stringStream.contains(PatternSTR) Then
' Things...
End If
End If
Next
End Sub
I've tried this methods but don't work for me! : How to get the names of all resources in a resource file
Upvotes: 0
Views: 1611
Reputation: 123
You could rather store your files in a folder and access them through
For Each Content As String In My.Computer.FileSystem.GetFiles("D:\Resources", FileIO.SearchOption.SearchTopLevelOnly, "*.txt")
ListBox1.Items.Add(Content)
Next
just an alternative solution for your problem
Upvotes: 1
Reputation: 20464
This is the way:
For Each ResourceFile As DictionaryEntry In My.Resources.ResourceManager.GetResourceSet(Globalization.CultureInfo.CurrentCulture, True, True).OfType(Of Object)()
If TypeOf (ResourceFile.Value) Is String Then
MsgBox(My.Resources.ResourceManager.GetObject(ResourceFile.Key))
'MsgBox(ResourceFile.Key) ' Resource Name
'MsgBox(ResourceFile.Value) ' Resource FileContent
End If
Next
Upvotes: 3