1. First, create a folder in your project (right click the project in the solution explorer then add/new folder, call it BlackjackImages).2. Right click the folder you just created, add/existing items, then browse to the images you want (say cardback.png).3. Select all these images in the solution explore, then go to the properties Windows, change the Build Action to Embedded Resources.4. Now in your code, to load cardback.png image you'd do:[code]Bitmap btmp = new Bitmap(GetType(), "BlackjackImages.cardback.png");[/code]Notice the names are case sensitive, if you do "blackjackimages." instead of "BlackjackImages." it wont work, same with the file name.

This is just another form of a namespace. When you added the files to the solution, you added them to the root namespace then into the folder BlackjackImages. So their namespace is:.BlackjackImages.FileNameIn the Bitmap constructor, the first parameter is a type to any of your root classes, .NET will use its namespace + the second parameter.Needless to say, if you make the "new Bitmap(GetType(), ..." call inside a namespace other than the root it wont work.

: I would like to know how to get images that I use in my program to get packed in the exe when it is built.: : Example: pictureBox1.Image = Image.FromFile("blackjack_images\cardback.png" );: : How would I get it so the files in blackjack_images where packed into th exe?: : Thnx for the help.:

This is my code that I would like to replace so it chooses from withing the project.The code selects from a file, Random & LSute are var set to get a card and sute randomly(in code before its calling).

Would I just do this to assign it to a pictureBox?[code] Bitmap btmp = new Bitmap(GetType(), "Images." + Random + LSute + ".png");

pictureBox1.Image = btmp;[/code]

: Here's how,: : 1. First, create a folder in your project (right click the project in the solution explorer then add/new folder, call it BlackjackImages).: 2. Right click the folder you just created, add/existing items, then browse to the images you want (say cardback.png).: 3. Select all these images in the solution explore, then go to the properties Windows, change the Build Action to Embedded Resources.: 4. Now in your code, to load cardback.png image you'd do:: [code]: Bitmap btmp = new Bitmap(GetType(), "BlackjackImages.cardback.png");: [/code]: Notice the names are case sensitive, if you do "blackjackimages." instead of "BlackjackImages." it wont work, same with the file name.: : This is just another form of a namespace. When you added the files to the solution, you added them to the root namespace then into the folder BlackjackImages. So their namespace is:: .BlackjackImages.FileName: In the Bitmap constructor, the first parameter is a type to any of your root classes, .NET will use its namespace + the second parameter.: Needless to say, if you make the "new Bitmap(GetType(), ..." call inside a namespace other than the root it wont work.

1. Create a folder in your project called "Images"2. Add the png files to that folder.3. Select them all, switch their build action to "Embedded Resources".

: This is my code that I would like to replace so it chooses from withing the project.The code selects from a file, Random & LSute are var set to get a card and sute randomly(in code before its calling).: : [code]: pictureBox1.Image = Image.FromFile( : "Images\" + Random + LSute + ".png" );: [/code]: : Would I just do this to assign it to a pictureBox?: [code]: Bitmap btmp = new Bitmap(GetType(), "Images." + Random + LSute + ".png");: : pictureBox1.Image = btmp;: [/code]: : : Here's how,: : : : 1. First, create a folder in your project (right click the project in the solution explorer then add/new folder, call it BlackjackImages).: : 2. Right click the folder you just created, add/existing items, then browse to the images you want (say cardback.png).: : 3. Select all these images in the solution explore, then go to the properties Windows, change the Build Action to Embedded Resources.: : 4. Now in your code, to load cardback.png image you'd do:: : [code]: : Bitmap btmp = new Bitmap(GetType(), "BlackjackImages.cardback.png");: : [/code]: : Notice the names are case sensitive, if you do "blackjackimages." instead of "BlackjackImages." it wont work, same with the file name.: : : : This is just another form of a namespace. When you added the files to the solution, you added them to the root namespace then into the folder BlackjackImages. So their namespace is:: : .BlackjackImages.FileName: : In the Bitmap constructor, the first parameter is a type to any of your root classes, .NET will use its namespace + the second parameter.: : Needless to say, if you make the "new Bitmap(GetType(), ..." call inside a namespace other than the root it wont work.: :