I have the following code in a project. I have a an rtf file called Rules.rtf which I added by right-mousing on my project name (Blisters)..(Rules.rtf's Build Action is 'Embedded Resource').
I get "File not found". Went to AI for help---no help there.
OH, and I have a standalone test project called textResource (meant to call it testResource but mistyped). Same code, except this line ---Dim resourceName As String = textResource.Rules.rtf--- and IT WORKS FINE. I have Imports System.Reflection and Imports System.IO outside the Class on both projects.
Any idea why it works in my test project, textResource, but not my main one, Blisters?
I get "File not found". Went to AI for help---no help there.
OH, and I have a standalone test project called textResource (meant to call it testResource but mistyped). Same code, except this line ---Dim resourceName As String = textResource.Rules.rtf--- and IT WORKS FINE. I have Imports System.Reflection and Imports System.IO outside the Class on both projects.
Any idea why it works in my test project, textResource, but not my main one, Blisters?
Code:
Dim resourceName As String = "Blisters.Rules.rtf"
Dim assembly As Assembly = Assembly.GetExecutingAssembly()
Using stream As Stream = assembly.GetManifestResourceStream(resourceName)
If stream IsNot Nothing Then
Using reader As New StreamReader(stream)
RTB1.Rtf = reader.ReadToEnd()
End Using
Else
MessageBox.Show("Resource not found.")
End If
End Using