We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

FolderBrowser initial selection

I am doing the following to set the initial selection... private void InternalFolderBrowserCallback(object sender, Syncfusion.Windows.Forms.FolderBrowserCallbackEventArgs e) { // On initialization set the inital directory... if(e.FolderBrowserMessage == FolderBrowserMessage.Initialized && m_initialDirectory != null) { e.FolderBrowserCallbackSetState = FolderBrowserCallbackSetState.SetSelection; e.BrowseCallbackText = m_initialDirectory; } } However, I am unable to set the initial selection to "My Documents" (under Desktop). I can only ever set it to "C:\Documents and Settings\\My Documents". Any ideas?

3 Replies

AD Administrator Syncfusion Team September 11, 2003 08:04 PM UTC

Hi Nik, Please take a look at the FolderBrowserDemo sample in the \Syncfusion\Essential Suite\Shared\Samples\FolderBrowserDemo\CS directory. If you look through the code, you will find that to set the StartLocation to 'MyDocuments' on the Desktop, you will have to use FolderBrowserFolder.Personal enumeration value. Programmatically you could do it by using the following code : this.folderBrowser1.StartLocation = FolderBrowserFolder.Personal; Please let me know if this helps. Regards, Guru Patwal.


NV Nik Vale September 15, 2003 02:20 PM UTC

Thanks for directing me to the sample. However, it is not the StartLocation I am trying to change it is the initial selection. I want the StartLocation to be the Desktop but I would like the "My Documents" folder to be selected and expanded (see attachment). The code I posted previously allows the initial selection to be set but it always selects "C:\Documents and Settingsvale\My Documents\" instead (see attachment). Thanks for you help.


AD Administrator Syncfusion Team September 16, 2003 11:15 AM UTC

Hi Nik, Sorry for having wrongly interpreted your question earlier. Setting the initial selection to "MyDocuments" maps to the CSIDL_MYDOCUMENTS CSIDL value and that as per the Shell docs, represents the logical "My Documents" desktop icon. Accessing the virtual "My Documents" folder involves accessing the PIDL through the desktop’s IShellFolder interface and the FolderBrowser component is currently restricted to the ::SHGetSpecialFolderLocation() API that uses the CSIDL values. We have an open feature request(QA# 118) on this issue and we will do our best to support this functionality in a future version of Essential Tools. Thanks for your patience. Regards, Guru Patwal.

Loader.
Live Chat Icon For mobile
Up arrow icon