Extract an Image Embedded as a Resource


/ Published in: VB.NET
Save to your folder(s)

Use this to extract an image embedded as a resource in your project. Call the function supplying the full path to the resource, for example:

Dim myImage as Bitmap = EmbeddedIcon("MyApplication1.myImage.png")

Where "MyApplication1" is the root namespace for the project.


Copy this code and paste it in your HTML
  1. Imports System.Reflection.Assembly
  2.  
  3. 'returns an embedded resource image by name
  4. Public Function EmbeddedImage(ByVal Name As String) As Bitmap
  5. Return New Bitmap(GetExecutingAssembly.GetManifestResourceStream(Name))
  6. End Function

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.