resource not found error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Trevor

    resource not found error

    I've got a bitmap file I want to use as a resource for an application. I
    went to the project, added and existing item (the bitmap), and then set it
    to embedded resource. When I run the app, I get the error:

    An unhandled exception of type 'System.Argumen tException' occurred in
    system.drawing. dll
    Additional information: Resource 'skin.bmp' could not be found in class
    'CodeTrue.Sales .SalesForm'.

    the code is simply:
    this.Background Image = new Bitmap(GetType( ), "skin.bmp") ;

    Oddly enough, I use this same bitmap (a copy of the file) in another
    project, and the same code works fine, so there must be something else that
    I'm missing. Any help on this would be great.

    Thanks,
    Trevor B


  • Champika Nirosh

    #2
    Re: resource not found error

    To where u add to image resource is it under the name space
    "CodeTrue.Sales .SalesForm" or is it some where else..

    I guess you may have add it to the root...

    just to clarify try.. typeof(CodeTrue ) instead of GetType() and see

    I don't think that the problem is with the btimap itself .. I think the
    problem is with the location you are asking the app to look for the image..

    Nirosh.

    "Trevor" <tbraun_dontwan tspam@codetrue. com> wrote in message
    news:%23W261UdR FHA.2412@TK2MSF TNGP10.phx.gbl. ..[color=blue]
    > I've got a bitmap file I want to use as a resource for an application. I
    > went to the project, added and existing item (the bitmap), and then set it
    > to embedded resource. When I run the app, I get the error:
    >
    > An unhandled exception of type 'System.Argumen tException' occurred in
    > system.drawing. dll
    > Additional information: Resource 'skin.bmp' could not be found in class
    > 'CodeTrue.Sales .SalesForm'.
    >
    > the code is simply:
    > this.Background Image = new Bitmap(GetType( ), "skin.bmp") ;
    >
    > Oddly enough, I use this same bitmap (a copy of the file) in another
    > project, and the same code works fine, so there must be something else[/color]
    that[color=blue]
    > I'm missing. Any help on this would be great.
    >
    > Thanks,
    > Trevor B
    >
    >[/color]


    Comment

    • Trevor

      #3
      Re: resource not found error

      This didn't help. I think the framework knows where to look, because the
      error tells me it can't find it in CodeTrue.Sales. SalesForm.
      But, for some reason, it's like the bitmap isn't getting embedded properly
      into the EXE.

      Thanks,
      Trevor


      "Champika Nirosh" <test@test.lk > wrote in message
      news:%23bHBlQkR FHA.2788@TK2MSF TNGP09.phx.gbl. ..[color=blue]
      > To where u add to image resource is it under the name space
      > "CodeTrue.Sales .SalesForm" or is it some where else..
      >
      > I guess you may have add it to the root...
      >
      > just to clarify try.. typeof(CodeTrue ) instead of GetType() and see
      >
      > I don't think that the problem is with the btimap itself .. I think the
      > problem is with the location you are asking the app to look for the
      > image..
      >
      > Nirosh.
      >
      > "Trevor" <tbraun_dontwan tspam@codetrue. com> wrote in message
      > news:%23W261UdR FHA.2412@TK2MSF TNGP10.phx.gbl. ..[color=green]
      >> I've got a bitmap file I want to use as a resource for an application. I
      >> went to the project, added and existing item (the bitmap), and then set
      >> it
      >> to embedded resource. When I run the app, I get the error:
      >>
      >> An unhandled exception of type 'System.Argumen tException' occurred in
      >> system.drawing. dll
      >> Additional information: Resource 'skin.bmp' could not be found in class
      >> 'CodeTrue.Sales .SalesForm'.
      >>
      >> the code is simply:
      >> this.Background Image = new Bitmap(GetType( ), "skin.bmp") ;
      >>
      >> Oddly enough, I use this same bitmap (a copy of the file) in another
      >> project, and the same code works fine, so there must be something else[/color]
      > that[color=green]
      >> I'm missing. Any help on this would be great.
      >>
      >> Thanks,
      >> Trevor B
      >>
      >>[/color]
      >
      >[/color]


      Comment

      • Trevor

        #4
        Re: resource not found error

        How can I find out if the bitmap has been embedded into the EXE?

        Trevor

        "Champika Nirosh" <test@test.lk > wrote in message
        news:%23bHBlQkR FHA.2788@TK2MSF TNGP09.phx.gbl. ..[color=blue]
        > To where u add to image resource is it under the name space
        > "CodeTrue.Sales .SalesForm" or is it some where else..
        >
        > I guess you may have add it to the root...
        >
        > just to clarify try.. typeof(CodeTrue ) instead of GetType() and see
        >
        > I don't think that the problem is with the btimap itself .. I think the
        > problem is with the location you are asking the app to look for the
        > image..
        >
        > Nirosh.
        >
        > "Trevor" <tbraun_dontwan tspam@codetrue. com> wrote in message
        > news:%23W261UdR FHA.2412@TK2MSF TNGP10.phx.gbl. ..[color=green]
        >> I've got a bitmap file I want to use as a resource for an application. I
        >> went to the project, added and existing item (the bitmap), and then set
        >> it
        >> to embedded resource. When I run the app, I get the error:
        >>
        >> An unhandled exception of type 'System.Argumen tException' occurred in
        >> system.drawing. dll
        >> Additional information: Resource 'skin.bmp' could not be found in class
        >> 'CodeTrue.Sales .SalesForm'.
        >>
        >> the code is simply:
        >> this.Background Image = new Bitmap(GetType( ), "skin.bmp") ;
        >>
        >> Oddly enough, I use this same bitmap (a copy of the file) in another
        >> project, and the same code works fine, so there must be something else[/color]
        > that[color=green]
        >> I'm missing. Any help on this would be great.
        >>
        >> Thanks,
        >> Trevor B
        >>
        >>[/color]
        >
        >[/color]


        Comment

        Working...