This works for me: private Bitmap GetEmbededBitmap( string sFilename ) { Assembly oThisAsm = Assembly.GetExecutingAssembly(); string sResourceName = oThisAsm.FullName.Split(',')[0]; sResourceName += "."; sResourceName += sFilename; return( new Bitmap( oThisAsm.GetManifestResourceStream(sResourceName) ) ); }
Make sure you are using System.Reflection Good luck! -----Original Message----- From: dotnet discussion [mailto:[EMAIL PROTECTED]] On Behalf Of Luis Abreu Sent: Wednesday, May 22, 2002 9:02 AM To: [EMAIL PROTECTED] Subject: [DOTNET] embed bitmap Hello guys. well I want to include a bitmap in a c# windows app. I've just checked the book programming windows wicth c# and the writer says that the only things one must do is change the properties of the file for embededresource and then load the bitmap using something like this: Bitmap b = new Bitmap( GetType(), "Bitmap1.bmp"); //in this case i have removed the resource namespace of the project. however, when I run the app i get an exception saying that the resource can't be found. so, what am i doing wrong? TIA. Regards, Luis Abreu http://www.luisabreu.go.cc/ mailto:[EMAIL PROTECTED] --------------------------------------------- "Those who give up never win, and those who win never give up!", Luis Abreu --------------------------------------------- You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.