Learn how to a build a cloud-first strategyRegister Now


Visual Studio Windows form image files

Posted on 2006-05-01
Medium Priority
Last Modified: 2010-05-18

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…..
Question by:Murray Brown
  • 2
LVL 96

Expert Comment

by:Bob Learned
ID: 16582448
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.

LVL 96

Expert Comment

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

LVL 10

Accepted Solution

ericwong27 earned 2000 total points
ID: 16582829
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

Author Comment

by:Murray Brown
ID: 16583940
Hi Bob

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



Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month20 days, 17 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question