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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:27:43+00:00 2026-06-12T13:27:43+00:00

In my C# application (using Visual Studio 2010 ultimate) the user needs to select

  • 0

In my C# application (using Visual Studio 2010 ultimate) the user needs to select a certain file. I’ve created a basic file explorer which pretty much works but doesn’t look great.

I’ve been asked to use the standard Windows file Explorer.

I know how to open it:

Process.Start("explorer.exe");

But how can I get a file path returned from 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-06-12T13:27:44+00:00Added an answer on June 12, 2026 at 1:27 pm

    To select a file, the Net Framework provides the OpenFileDialog component.
    You can see the reference at MSDN here

    But basically, all you have to do is:

    Create an Instance of OpenFileDialog

    using(OpenFileDialog openFileDialog1 = new OpenFileDialog())
    {
    

    Set the initial property

        openFileDialog1.InitialDirectory = "c:\\" ;
        openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*" ;
        openFileDialog1.FilterIndex = 2 ;
        openFileDialog1.RestoreDirectory = true ;
    

    Open the control calling the ShowDialog, wait for the OK press from the user and grab the file selected

        if(openFileDialog1.ShowDialog() == DialogResult.OK)
        {
            string fileSelected = openFileDialog1.FileName;
        }
    }
    

    Notice the using statement around the OpenFileDialog(), while not strictly necessary this will assure the Disposing of the dialog

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

Sidebar

Related Questions

I'm learning basic c# using visual studio 2010 and I'm creating an application which
I am using SQL Server Express edition for my application (Visual Studio 2010 Ultimate,
Using: Visual Studio 2010 Created: Console Application in C# Accessing: a Java created WSDL
Environment: Visual Studio Ultimate 2010 Windows XP WPF Desktop Application using .NET 4.0 We
I have created a web application using ext.net and c# in visual studio 2010.
I've developed an application using Visual Studio 2010, which by default compiles to the
I have deployed this application using Visual Studio 2010's Publish feature; it needs to
I'm using Visual Studio 2010 Ultimate. In a simple Windows application I just want
I'm building an application using Visual Studio 2010 in which I have to use
I have created a new WPF Application using Visual Studio 2010 so I have

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.