Re: Image error

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: vish (vish2cu_at_hotmail.com)
Date: 07/13/04


Date: Tue, 13 Jul 2004 21:50:26 +0530

Try :
string imgPath =
System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssem
bly().GetName().CodeBase);
this.pictureBox1.Image = new Bitmap(imgPath + @"\imageName.jpg");

"Neil Cowburn [MVP]" <neil@online.cowburn.me.uk> wrote in message
news:#A8xdwOaEHA.596@TK2MSFTNGP11.phx.gbl...
> It could be:
>
> (a) imageName is an empty string
> (b) the image referenced by imageName is not in the assembly's manifest
> (c) imageName is missing its file extension
> (d) the namespace is incorrect
>
> HTH
> Neil
>
> "yamne" <damiano_callegari@libero.it> wrote in message
> news:uWnpFbNaEHA.4048@TK2MSFTNGP10.phx.gbl...
> > When I do:
> >
> > Image Pippo = new
> > Bitmap(System.Reflection.Assembly.GetExecutingAssembly().
> >
> > GetManifestResourceStream("MedicAlertClient.images." + imageName));
> >
> >
> > I have this error:
> >
> > An unhandled exception of type 'System.NullReferenceException' occurred
in
> > System.Drawing.dll
> >
> > Why???
> >
> > Thanks
> > Damiano
> >
> >
>
>