Can OpenDialog remember the last directory used?

The OpenDialog class has an InitialDirectory property.

How should one set this value, based on the last location that was open by the user.

Like, where do you store the value, so that the next invocation of the app can recall the value between invocations.

(Too save steps navigating back to the ‘preferred’ folder.)

I don’t seem to have this issue with my web apps, but my desktops seem to manifest this.

I assume you’re using OpenFileDialog. You can then set the InitialFolder property.

I save the foler to be used as a string in a database.

1 Like

If you don’t set the InitialDialog property, the system takes over and will remember the last directory used.

Additionally, in some cases if you set this property to a folder your app hasn’t been already blessed to access the user will be presented with a “MyGreatApp wants to access your Documents folder” dialog.

My personal recommendation is to never set this property.

3 Likes

That gem appears not to be mentioned in the docs. Which is why I save it myself.

1 Like

Well if it’s working for your project, don’t break what’s not broken!

If you’d like to see the behavior in action, you can play with my free app VersionTracker

What a Gem that is man. wow! :slight_smile:

Any reason why version tracker doesn’t have a Linux version? I’d like to try it out :slight_smile: