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 9250077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:21:40+00:00 2026-06-18T10:21:40+00:00

I have a Windows Forms project. I have a Resources folder and I wan

  • 0

I have a Windows Forms project. I have a Resources folder and I wan to use the files there using relative path. Here is a printscreen of my project tree

enter image description here

As you may see I have folder UserControls where I have FileExplorer.cs it contains aa openFileDialog + pictureBox. I use this control in some of my forms which are in Forms folder. The case is that in Resources folder I have this T380.jpg image that I want to load by default but for now I can do it only by inserting the full path to it. Here is my code where I try to load the image:

 private void FileExplorer_Load(object sender, EventArgs e)
        {
            pictureBox1.ImageLocation = @"ShoesUnlimitedAdmin\Resources\T380.jpg";
            pictureBox1.Load();
        }

I use the Load event of the user control to load my image but it only works when I set the full path to the image like C:\\... and so. How can I point to the Resources folder of the project using relative path?

  • 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-18T10:21:42+00:00Added an answer on June 18, 2026 at 10:21 am

    If these images are small then favor adding them as resources in the executable file so you can use Properties.Resources in your code and don’t have to deploy the files on the user’s machine. Use Project + Properties, Resources. Click the arrow on the “Add Resource” button and select Add Existing File.

    If they are big (more than a couple of megabytes) then you’ll indeed want to deploy them as separate files. You can find them back by using the location of the EXE program, here’s a helper method, spelled out for clarity:

        public static string GetResourcePath(string filename) {
            string exepath = System.Reflection.Assembly.GetEntryAssembly().Location;
            string exedir = System.IO.Path.GetDirectoryName(exepath);
            string resdir = System.IO.Path.Combine(exedir, "Resources");
            return System.IO.Path.Combine(resdir, filename);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Windows Forms project in Visual Studio that reads configuration files from
I have a C# project using windows forms. I need to let the user
Iam using c# vs2010. For my windows forms project I have some PNG,Gif,Jpg images
I have got a windows forms project than copying files and folders to clients
I have a Windows Forms project in Visual Studio 2008, which references a library
I have a C# Windows Forms project open with some C# code in it.
I have a c# windows form project using watin. I would love to attach
I have a Windows Forms project with a TabControl . Does anyone know how
I have a Windows Forms project. For some controls the property Image has value
I have a windows forms project. It has a main form derived from System::Windows::Forms::Form

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.