error: null is not valid value for stream

Dim strm As System.IO.Stream = Me.GetType().Assembly.GetManifestResourceStream("fullbuttonface.bmp")

_buttonFace = New Bitmap(strm)

May be the bitmap file is not part of the assembly, how do I put it in the assembly

Thanks




Answer this question

error: null is not valid value for stream

  • t-m00re

    1- how do i embed the image

    2- Is this what assemblies are good for, is this the purpose of using assmblies

    Thanks



  • M.CeYLaN

    I can t find where I can set my image as an embedded resource


  • JulyBetaDoesntWork

    Add a bitmap to your project by saying add new item and selecting "Images" in the drop down list and then set the image as an embedded resource
  • mayankjohri

    u re so right Chris, u save my life with your idea:  MyWindows.fullbuttonface.bmp

    That s perfect. Thanks to karthik as well.

    Thanks a lot guys



  • NeilDholakia

    I found and configured my image fil as an embeded in build action, but I still get strm variable  in my code bellow as nothing when i debug:

    Dim strm As System.IO.Stream = Me.GetType().Assembly.GetManifestResourceStream("fullbuttonface.bmp")

    _buttonFace = New Bitmap(strm)

    weird



  • Magaviga

    In addition, don't forget to make your image as "Embedded Resource" and take note of the default namespace of your project, as this will be appended to the name of your image internally.

    For example, your default namespace is "MyWindows" and your image name is "fullbuttonface.bmp"; your resource name will become:

    MyWindows.fullbuttonface.bmp

    Hope this helps,

    -chris



  • error: null is not valid value for stream