Posted on 2009-07-13
Last Modified: 2012-05-07
I have a images.resx and have included this into my classLib but I get error when running my program telling me that I miss a dll file or something.

The images.resx I have found on the net and I would like to use it, but how do I add it to my project so I can use it?

What do you need to know?

Here is the image.resx I want to add

Question by:Mickeys
1 Comment
LVL 12

Accepted Solution

topdog770 earned 500 total points
ID: 24855266
Here's a simple start
using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using System.IO;

using System.Resources;

using System.Reflection;

using System.Collections;

namespace WindowsFormsApplication1


    public partial class Form1 : Form


        ResXResourceReader r = new ResXResourceReader("..\\..\\Images.resx");

        IDictionaryEnumerator en; 

        public Form1()



            this.Load += new EventHandler(Form1_Load);


        void Form1_Load(object sender, EventArgs e)


            r = new ResXResourceReader("..\\..\\Images.resx");

            en = r.GetEnumerator();



                DictionaryEntry de = (DictionaryEntry)en.Current ;

                this.imageList1.Images.Add(de.Key.ToString(), de.Value as Image);

                this.imageList2.Images.Add(de.Key.ToString(), de.Value as Image);

                this.listView_Resources.Items.Add(de.Key.ToString(), de.Key.ToString());


            en = r.GetEnumerator();



        private void button1_Click(object sender, EventArgs e)




        private void GetNextResource()


            if (en != null)



                Bitmap b = ((DictionaryEntry)en.Current).Value as Bitmap;

                this.pictureBox1.Image = b;



        private void listView_Resources_SelectedIndexChanged(object sender, EventArgs e)


            if (this.listView_Resources.SelectedItems.Count > 0)


                if (imageList2.Images.ContainsKey(listView_Resources.SelectedItems[0].Text))


                    this.pictureBox1.Image = imageList2.Images[listView_Resources.SelectedItems[0].Text];




        #region Designer Code

        /// <summary>

        /// Required designer variable.

        /// </summary>

        private System.ComponentModel.IContainer components = null;

        /// <summary>

        /// Clean up any resources being used.

        /// </summary>

        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>

        protected override void Dispose(bool disposing)


            if (disposing && (components != null))






        #region Windows Form Designer generated code

        /// <summary>

        /// Required method for Designer support - do not modify

        /// the contents of this method with the code editor.

        /// </summary>

        private void InitializeComponent()


            this.components = new System.ComponentModel.Container();

            this.pictureBox1 = new System.Windows.Forms.PictureBox();

            this.listView_Resources = new System.Windows.Forms.ListView();

            this.imageList1 = new System.Windows.Forms.ImageList(this.components);

            this.imageList2 = new System.Windows.Forms.ImageList(this.components);




            // pictureBox1


            this.pictureBox1.Location = new System.Drawing.Point(132, 13);

            this.pictureBox1.Name = "pictureBox1";

            this.pictureBox1.Size = new System.Drawing.Size(198, 239);

            this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;

            this.pictureBox1.TabIndex = 0;

            this.pictureBox1.TabStop = false;


            // listView_Resources


            this.listView_Resources.Location = new System.Drawing.Point(12, 13);

            this.listView_Resources.Name = "listView_Resources";

            this.listView_Resources.Size = new System.Drawing.Size(114, 239);

            this.listView_Resources.SmallImageList = this.imageList1;

            this.listView_Resources.TabIndex = 2;

            this.listView_Resources.UseCompatibleStateImageBehavior = false;

            this.listView_Resources.View = System.Windows.Forms.View.SmallIcon;

            this.listView_Resources.SelectedIndexChanged += new System.EventHandler(this.listView_Resources_SelectedIndexChanged);


            // imageList1


            this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth24Bit;

            this.imageList1.ImageSize = new System.Drawing.Size(16, 16);

            this.imageList1.TransparentColor = System.Drawing.Color.Transparent;


            // imageList2


            this.imageList2.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;

            this.imageList2.ImageSize = new System.Drawing.Size(71, 96);

            this.imageList2.TransparentColor = System.Drawing.Color.Transparent;


            // Form1


            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

            this.ClientSize = new System.Drawing.Size(339, 261);



            this.Name = "Form1";

            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;

            this.Text = "Form1";





        private System.Windows.Forms.PictureBox pictureBox1;

        private System.Windows.Forms.ListView listView_Resources;

        private System.Windows.Forms.ImageList imageList1;

        private System.Windows.Forms.ImageList imageList2;




Open in new window


Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
detecting  the added row index in a datagridview 3 54
c# if statement weird reaction 3 42 dynamic formulas in runtime 11 61
Syntax error 9 45
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…

932 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now