Visual Studio Windows form image files


I am building a Windows form in visual studio 2005, which includes several small bitmap files that are loaded into a PictureBox in various scenarios.

What is the best way to load these images (and if necessary delete them) into the project,
so that the project does not have to reference any files outside of the project folders.

Is the correct approach to save the bitmap files into a new sub-folder of the main folder and then load them by clicking on the image property and and loading them into the project resource/local resource file.

In short I want to be able to cleanly load/unload bitmap files so that they are part of the project and not connected to anything outside of it.

Thank you in advance…..
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAsked:
Who is Participating?
ericwong27Connect With a Mentor Commented:
You can use the Resource Designer to add or edit resources for your project. Resource types supported by the Resource Designer include strings, images, icons, audio, and files.

1. With a project selected in Solution Explorer, on the Project menu click Properties.

2. Select the Resources tab.

3. On the Resource Designer toolbar, point to Add Resource, click the arrow, then click Add Existing File.

4. In the Add existing file to resources dialog box, browse to the file containing the resource that you wish to add (.bmp, .ico, .wav, etc,), and then click Open.

5. Assume you add 2 image file and the name is Image1.bmp, Image2.bmp

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Me.PictureBox1.Image = My.Resources.Images1

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        Me.PictureBox1.Image = My.Resources.Images2

    End Sub
Bob LearnedCommented:
1) Are these dynamic or static images?

2) If they are static, then you can load the images into the PictureBox controls, and the images will be stored in binary format in the .resx file associated with the form.

Bob LearnedCommented:
BTW, I have come up with a working Excel border dialog, if you are interested in a working example.

Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Hi Bob

I am really interested in seeing a working example for an Excel border dialog


Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.