
Reference embedded resource
Quote:
> How do I reference a resource I have embedded in a application?
> I have an image (image1.jpg) that I need to set as the
> background for a form. I have added the image to the project
> and set the build action to embedded resource. However, I can't
> figure out how to pull that out to use it as my background.
imports system.reflection
'...
Dim img As Image
Dim stream As IO.Stream
Dim assy As [Assembly] = [Assembly].GetExecutingAssembly
stream = assy.GetManifestResourceStream("myapp.image1.jpg")
img = Image.FromStream(stream)
stream.Close()
Replace "myapp" by the root namespace of your project.
Armin