Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27328

Loading an RTB with .rtf file, but 'add' to executable

$
0
0
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?

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


Viewing all articles
Browse latest Browse all 27328

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>