Permalink
Fetching contributors…
Cannot retrieve contributors at this time
48 lines (40 sloc) 2 KB
title ms.custom ms.date ms.prod ms.reviewer ms.suite ms.technology ms.tgt_pltfrm ms.topic dev_langs helpviewer_keywords ms.assetid caps.latest.revision author ms.author manager
How To: Add a Custom Place to a File Dialog Box
03/30/2017
.net-framework
dotnet-winforms
article
jsharp
Custom Place to dialog box
adding Custom Place to dialog box
CustomPlaces collection
63f6469b-59cd-40f6-9e61-8b5831856780
13
dotnet-bot
dotnetcontent
wpickett

How To: Add a Custom Place to a File Dialog Box

The default open and save dialog boxes on [!INCLUDEwiprlhext] have an area on the left side of the dialog box titled Favorite Links. This area is called custom places. The xref:System.Windows.Forms.OpenFileDialog and xref:System.Windows.Forms.SaveFileDialog classes allow you to add folders to the xref:System.Windows.Forms.FileDialog.CustomPlaces%2A collection.

[!NOTE] In order for a custom place to appear in the xref:System.Windows.Forms.OpenFileDialog or xref:System.Windows.Forms.SaveFileDialog, the xref:System.Windows.Forms.FileDialog.AutoUpgradeEnabled%2A property must be set to true (the default).

To add a custom place to a file dialog box

  • Add a path, a Known Folder GUID, or a xref:System.Windows.Forms.FileDialogCustomPlace object to the xref:System.Windows.Forms.FileDialog.CustomPlaces%2A collection of the dialog box.

    The following code example shows how to add a path:

    OpenFileDialog1.CustomPlaces.Add("C:\MyCustomPlace")  
    openFileDialog1.CustomPlaces.Add("C:\\MyCustomPlace");  

See Also

xref:System.Windows.Forms.FileDialog
xref:System.Windows.Forms.FileDialogCustomPlacesCollection.Add%2A?displayProperty=nameWithType
Known Folder GUIDs for File Dialog Custom Places