im creating a custom button . when user select a image file for button image i want to add it to the project resource (in design time) . how to do this??

im currently drawing image using image location but its not a good solution.

Recommended Answers

All 8 Replies

Add the image as new item in your project. Use the *.* filter to locate it, and insert.
on your project, select the image prperties and change the build action to embedded resource.

Hope this helps

Add the image as new item in your project. Use the *.* filter to locate it, and insert.
on your project, select the image prperties and change the build action to embedded resource.

Hope this helps

can u explain more ??

To add images or any file/files to My.Resources, follow these little steps.

First, check out the 3attached.images, in the order they appear.
2nd, you're done.:)

With PictureBox1
            .Image = My.Resources.jessica_alba
        End With

3rd, Jessica Alba is a hottie.:*

commented: thnx +2

Steps on VS2010:
Method A)
1)Select your project
2)Right click and select the option Add
3)Select the option Existing Item
4)On the lower right corner Select the option All Files (*.*)
5)Using the left pane, nevigate to the place where the image or icon is located
6)On the right pane, select the image you want to include and click on the Add button located in the lower right corner.
7)The image is copied into the source folder of your project.
8)On the Solution Explorer select the image and right click. Select the Properties option.
9)On the properties pane, find the Build Action. Change it to Embedded Resource.
10) Save your project

Method B)

1) Select your project.
2) On the VS2010 Menu, select Project, then the las one (yourprojectname properties)
3) Select the resources tab
4) On the top of this form, Click on Add Resource
5) Select the Add existing file
6) Continue with the steeps 4 to 7 of method A)
7) Select the image in the Resources tab, and see the properties pane
8) Find the persistance option and change it to Embedded in .resx
9) Save your project.

Hope this helps

thnx .

"3rd, Jessica Alba is a hottie." lol :D of coz

Glad I could help in more ways than1, "coz".:)
.Now mark your sh.t as Solved before I start the cussing, and it won't involve anything about hotties.:D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.