Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8613081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:47:04+00:00 2026-06-12T04:47:04+00:00

I have a string array abc I put this in a for each loop.

  • 0

I have a string array “abc”
I put this in a for each loop. I want to retrieve an image from resources using the value in the foreach loop and put it into a picture box.

code below:

char[] stringArr = inputted.ToCharArray();
        foreach (char i in stringArr)
        {
            PictureBox pictureBox = new PictureBox(); 
            object obj = ResourceManager.GetObject(i.ToString());
            pictureBox.Image = ((System.Drawing.Bitmap)(obj));
            Controls.Add(pictureBox);
        }

What do i have to do to get this working?
What i am trying to achieve, is a have pictures, each character in the alphabet represents a different picture, the user inputs a string and clicks a button, the users inputs is taken, formed to the stringArr and i want it to output the relevant images based on the string he inputted

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T04:47:06+00:00Added an answer on June 12, 2026 at 4:47 am

    You could do something like:

    object obj = ResourceManager.GetObject("MyResourceName", resourceCulture);
    return ((System.Drawing.Bitmap)(obj));
    

    To get a resource by name.

    With ResourceManager being something like:

    var ResourceManager = 
        new System.Resources.ResourceManager(
            "YourAssembly.Properties.Resources", 
            typeof(Resources).Assembly);
    

    So in your example you could write:

    foreach (char i in stringArr)
    {
        PictureBox pictureBox = new PictureBox();
    
        object obj = ResourceManager.GetObject(i.ToString(), resourceCulture);
        pictureBox.Image = ((System.Drawing.Bitmap)(obj));
    }
    

    (You also could omit the resourceCulture parameter if your image is of no special culture).

    I do assume that your code is just an excerpt from a larger example since it makes no sense to me to create a PictureBox inside a look and not assign it to a form.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a string ABC DEF EFG and i want to get an array:
I have a string array: array = ['123';'abc';'uvw']; I want convert it to a
Let's say I have game.abc as a string (array of chars) and I want
I have a string that looks like this: abc[1,2,3].something.here,foo[10,6,34].somethingelse.here,def[1,2].another I want to split this
I have this in PHP: $data = array(test=>array(abc=>xyz)); I want to append ' data:
I have splitted comma separated values in an string array, something like this str[0]
I have List<string> strs; double[] values; where the values array contains the value of
I have List<string> strs; double[] values; where the values array contains the value of
I have a string and an array of values, I want to check how
I have a string and I want is split into an array so that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.