Initialise OpenFileDialog to a virtual directory

  • Thread starter Thread starter Gareth
  • Start date Start date
G

Gareth

Hi,

I fear the answer to this is "no chance". Does anyone know how to set
the InitialDirectory of an OpenFileDialog to a virtual folder, like "My
Computer" or "My Network Places"?

Thanks for any ideas,

Gareth
 
using System;
using System.Windows.Forms;

namespace OpenFileDialogTest
{
class Test
{
const string MyComputer = "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}";
const string MyDocuments = "::{450D8FBA-AD25-11D0-98A8-0800361B1103}";
const string MyNetworkPlaces = "::{208D2C60-3AEA-1069-A2D7-08002B30309D}";
const string Printers = "::{2227A280-3AEA-1069-A2DE-08002B30309D}";
const string RecycleBin = "::{645FF040-5081-101B-9F08-00AA002F954E}";
const string Tasks = "::{D6277990-4C6A-11CF-8D87-00AA0060F5BF}";

[STAThread]
static void Main(string[] args)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.InitialDirectory = MyComputer;
ofd.ShowDialog();
}
}
}
 
Gabriele said:
using System;
using System.Windows.Forms;

namespace OpenFileDialogTest
{
class Test
{
const string MyComputer = "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}";
const string MyDocuments = "::{450D8FBA-AD25-11D0-98A8-0800361B1103}";
const string MyNetworkPlaces = "::{208D2C60-3AEA-1069-A2D7-08002B30309D}";
const string Printers = "::{2227A280-3AEA-1069-A2DE-08002B30309D}";
const string RecycleBin = "::{645FF040-5081-101B-9F08-00AA002F954E}";
const string Tasks = "::{D6277990-4C6A-11CF-8D87-00AA0060F5BF}";

[STAThread]
static void Main(string[] args)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.InitialDirectory = MyComputer;
ofd.ShowDialog();
}
}
}

Thanks Gabriele - that's brilliant!

Gareth
 
Back
Top