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

  • Home
  • SEARCH
  • 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 6790335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:42:48+00:00 2026-05-26T17:42:48+00:00

I have created a picturebox within my panel and I would like to fill

  • 0

I have created a picturebox within my panel and I would like to fill it up with an image locally.

this is what I have done so far and the following code is just a small part of my panel creation code.

PictureBox picture = new PictureBox
        {
            Name = "pictureBox",
            Size = new Size(100, 50),
            Location = new Point(14, 17)
        };
        p.Controls.Add(picture);
        picture.ImageLocation = @"..\Image\1.jpg";

It does works but not fully as after I have launch my c# windows form application, it jus show a small white box with a red cross in the middle instead of the image. Any idea how to solve it?

  • 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-05-26T17:42:48+00:00Added an answer on May 26, 2026 at 5:42 pm

    Setting the image using picture.ImageLocation() works fine, but you are using a relative path. Check your path against the location of the .exe after it is built.

    For example, if your .exe is located at:

    <project folder>/bin/Debug/app.exe

    The image would have to be at:

    <project folder>/bin/Image/1.jpg


    Of course, you could just set the image at design-time (the Image property on the PictureBox property sheet).

    If you must set it at run-time, one way to make sure you know the location of the image is to add the image file to your project. For example, add a new folder to your project, name it Image. Right-click the folder, choose “Add existing item” and browse to your image (be sure the file filter is set to show image files). After adding the image, in the property sheet set the Copy to Output Directory to Copy if newer.

    At this point the image file will be copied when you build the application and you can use

    picture.ImageLocation = @"Image\1.jpg"; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a label using the following code: public static System.Windows.Forms.PictureBox pc =
I created an array of PictureBox objects in my code like so: PictureBox[] picturbox
Hey all i have created dynamic buttons at runtime and i would like to
I have created an array square(40) as picturebox. I have to assign 40 picture
I have created 3 classes as following Ext.mine.TextParent - Inherting from Textfield Ext.mine.child.TextChildA -
I wrote a bunch of code and i would like to fix it the
I have extended a PictureBox and created a singleton. Is it possible to display
I have a project in C#, WindowsForms and I created a panel that contains
I have a PictureBox as UserControl . I added this User Control on the
I have made an Intensity meter in a pictureBox. For making this intensity meter

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.