.NET Code To Set OpenFileDialog Initial Folder With a String


This code uses a string to set the initial folder of an OpenFileDialog.

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();
  }
}