Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. File Open Dialog Question

File Open Dialog Question

Scheduled Pinned Locked Moved C#
question
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jeff Patterson
    wrote on last edited by
    #1

    I have a file open dialog that I use to pick files from two different directories. I am trying to remember the directory so that the user doesn't have to switch directories often. This code below only remembers the last directory open. The initial directory function doesn't seem to work. I have tried RestoreDirectory function as both true and false. It also doesn't seem to work. Any ideas as to what I am doing wrong? The code snippet Stream myStream; string pickedFile = ""; openFileDialog.Title = "Locate Tranlator Directory"; openFileDialog.Filter = "Fanuc Translators (*.exe)|*.exe|All files (*.*)|*.*" ; if(!Directory.Exists(transDir)) {   transDir = ""; } openFileDialog.FilterIndex = 1 ; openFileDialog.RestoreDirectory = false ; openFileDialog.InitialDirectory = transDir; if(openFileDialog.ShowDialog() == DialogResult.OK) {   if((myStream = openFileDialog.OpenFile())!= null)   {     pickedFile = openFileDialog.FileName.ToString();     transDir = Path.GetDirectoryName(pickedFile);   } } /code> Jeff Patterson Programmers speak in Code. [http://www.anti-dmca.org](http://www.anti-dmca.org)[[^](http://www.anti-dmca.org "New Window")]

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups