Vb.NET - Access an Embedded Resource



Shows how to get an embedded resource, .bmp file, and display it in a PictureBox.

'Assembly: System.Windows.Forms.dll

'Namespace: Microsoft.VisualBasic
'Namespace: System
'Namespace: System.Drawing
'Namespace: System.Reflection
'Namespace: System.Windows.Forms

'Darg and Drop a Picturbox control
'Dim PictureBox AS System.Windows.Forms.PictureBox = "PictureBox1"

Private Sub LoadPicture()
     Dim bmpSource As Bitmap
        Dim asm As System.Reflection.Assembly
        asm = System.Reflection.Assembly.GetExecutingAssembly()

        PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
        Try
            bmpSource = New Bitmap(asm.GetManifestResourceStream("SyntaxHelp.bmp"))
            PictureBox1.Image = bmpSource
        Catch ex As NullReferenceException
        End TryEnd Sub

Share |

 Cant find the page you are looking for?
 Help us to improve by adding the content that you are looking for.
 Leave a feedback
 We look forward to hear your comments and feedback.