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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:38:39+00:00 2026-06-10T03:38:39+00:00

I thought using application settings would do the trick but I’m not getting it

  • 0

I thought using application settings would do the trick but I’m not getting it to work. This is what I have:

private void btnBrowse_Click(object sender, EventArgs e)
        {
            if (fbFolderBrowser.ShowDialog() == DialogResult.OK)
            {
                // I want to open the last folder selected by the user here.
            }

When the user clicks on this button, I want to open the browse window to the last folder he accessed and save it. Next time he clicks on the button, it’ll automatically select that folder.

I was thinking maybe I could use user variables where I can change at run-time but I’m not getting it to work. Can anyone give me a hand?

  • 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-10T03:38:40+00:00Added an answer on June 10, 2026 at 3:38 am

    There are two places where you can find the last folder accessed by a user:

    1. Recent Files and Folders: It can be found here: C:\Documents and Settings\USER\Recent
    2. Registry: In the registry to look here: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU

    You can use this snippet to find it:

    public static string GetLastOpenSaveFile(string extention)
    {
        RegistryKey regKey = Registry.CurrentUser;
        string lastUsedFolder = string.Empty;
        regKey = regKey.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\OpenSaveMRU");
    
        if (string.IsNullOrEmpty(extention))
            extention = "html";
    
        RegistryKey myKey = regKey.OpenSubKey(extention);
    
        if (myKey == null && regKey.GetSubKeyNames().Length > 0)
            myKey = regKey.OpenSubKey(regKey.GetSubKeyNames()[regKey.GetSubKeyNames().Length - 2]);
    
        if (myKey != null)
        {
            string[] names = myKey.GetValueNames();
            if (names != null && names.Length > 0)
            {
                lastUsedFolder = (string)myKey.GetValue(names[names.Length - 2]);
            }
        }
    
        return lastUsedFolder;
    }
    

    OR

    In windows XP when you press Save on a SaveFileDialog the directory where the file is saved, is set as the new current working directory (the one in Environment.CurrentDirectory).

    In this way, when you reopen the FileDialog, it is opened on the same directory as before.

    By setting FileDialog.RestoreDirectory = true, when you close the FileDialog the original working directory is restored.

    In Windows Vista/Seven the behavior is always as FileDialog.RestoreDirectory = true.

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

Sidebar

Related Questions

For a simple chat application, I thought of using this simple layout: *----------------------------------* |<div>
We have some performance problems with one of our applications. I thought about using
I know this might sound easy. I thought about using the first dot(.) which
for a C++ Web-Server I have to generate session id's. I thought of using
i'm trying to get computer's state in my LAN... thought about using QTcpSocket but
I thought I'd try a simple GUI app using the world/universe mutation-free approach, but
I thought that latest Matlab does this automatically. I have tested the following exe
OK I've seen a few people with this issue - but I'm already using
I'm sure this is a simple issue, but I have noticed that when I
Update : I have tried using fuslogvw.exe to get logs. But what exactly am

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.