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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:08:25+00:00 2026-05-23T02:08:25+00:00

First time poster (and newbie). I’ve created a C# winform application. I’ve added a

  • 0

First time poster (and newbie).

I’ve created a C# winform application.
I’ve added a “Documents” folder in which I’ve added 5 PDF files.

From within my Form1, I’ve added a button and inside the button click event, I’m trying to get the files from that “Documents” folder.

I’ve googled around and found stuff like this:

string[] arr = Directory.GetFiles(string path);

But I do not wish to “hardcode” the path of my “Documents” folder.
I’d like to know if there’s a way (more dynamic) to obtain the path of my “Documents” folder.

I’ve also found these:

string path1 = Path.GetDirectoryName(Application.ExecutablePath);
string path2 = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

But they always bring me to my \bin\Debug folder.

I’ll take all the help I can get!
Thanks!

  • 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-23T02:08:26+00:00Added an answer on May 23, 2026 at 2:08 am

    Environment.SpecialFolder enumeration you mean?

    Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
    

    Or am I misreading the question?

    EDIT

    I guess I did misread, my apologies. Try this:

    string documents = Path.Combine(
                         Path.GetDirectoryName(Application.ExecutablePath),
                         "Documents"
                       );
    

    This is also assuming you’re including the items from the “documents” folder as resources so the executable will be able to see them.

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

Sidebar

Related Questions

First time poster, be gentle ;-) I'm writing an audio app (in C++) which
First time poster so please bear with me. Basically I have a pdf document
First time poster here :). I'm having the following trouble automating Excel 2010 from
first time poster and TDD adopter. :-) I'll be a bit verbose so please
First time poster here. A quick question about setting up a loop here. I
first time poster, long time reader so be gentle with me :) See the
Long time reader, first time poster. Any help is greatly appreciated. I have crafted
I'm a long running fan of stackoverflow, first time poster. I'd love to see
First time Stack Overflow poster. Please bear with me! :) I have a set
First time poster, so please excuse any stupidity. I'm working on porting a custom

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.