I found the solution. I had the following code before the point where
the code broke.
if (pictBarcodeTest != null)
{
pictBarcodeTest.Dispose();
pictBarcodeTest = null;
}
which made the picturebox a null object. I got rid of this code and it
now works.
Scott
On Jun 15, 8:16 am, "Scott M." <[email protected]> wrote:
> Sorry, the error is "Object reference not set to an instance of an
> object."
>
> On Jun 15, 5:31 am, Cerebrus <[email protected]> wrote:
>
>
>
> > Since you insist of keeping the error message itself secret, it
> > becomes extremely difficult for us to divine exactly what you are
> > doing wrong. In any case, this appears to be code that can be easily
> > debugged to determine the cause of the error.
>
> > On Jun 15, 1:20 am, "Scott M." <[email protected]> wrote:
>
> > > I am having a problem trying to use two tiny bitmaps that I placed in
> > > a resource file. The bitmaps are a green checkmark and a red X. I have
> > > the following code;
>
> > > ResourceManager resourceManager = new
> > > ResourceManager("RaptorAccessoryTest.Properties.Resources",
> > > GetType().Assembly);
>
> > > Bitmap image = (Bitmap)resourceManager.GetObject("GreenCheck");
>
> > > Now I want to use the bitmap. I get the error when I run;
>
> > > pictBarcodeTest.Image = image;
>
> > > so I tried this instead, with no success;
>
> > > pictBarcodeTest.Image = new Bitmap(image);
>
> > > What am I doing wrong?
>
> > > Scott- Hide quoted text -
>
> > - Show quoted text -