I'm curious and it could give my little app a nice finishing touch. Thanks!
4 Answers
You can't if you use the class FolderBrowserDialog
directly. But I read somewhere that it could be possible to change the title with P/Invoke and sending WM_SETTEXT
message.
In my opinion, it is not worth the pain. Just use the property Description
to add the information:
FolderBrowserDialog dlg = new FolderBrowserDialog();
dlg.Description = "Select the document folder";

- 7,988
- 6
- 39
- 45

- 7,018
- 2
- 32
- 54
-
it there any way we change the title of "FolderBrowserDialog" . Because "dlg.Description" just show Description. – Ahmad May 29 '18 at 10:55
-
4Since .NET Core 3 you can use the `UseDescriptionForTitle` property on `FolderBrowserDialog`. https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.folderbrowserdialog.usedescriptionfortitle?view=netcore-3.0 – TorbenJ Oct 15 '19 at 06:26
-
Setting the `UseDescriptionForTitle` did the job for me! Thanks @TorbenJ – AxleWack Aug 04 '23 at 18:02
The simple answer is that you can't. The dialog displays using the standard title for a folder browser style dialog on Windows. The best option is to ensure that you have meaningful descriptive text by setting the Description property.
Even if you were to use P/Invoke to call the SHBrowseForFolder Win32 API function directly, the only option you still can't change the actual title of the dialog. You can set the lpszTitle field of the BROWSEINFO structure, which is
A pointer to a null-terminated string that is displayed above the tree view control in the dialog box. This string can be used to specify instructions to the user.

- 42,236
- 12
- 79
- 110
-
If you use p/invoke, changing the title should be no problem. The documentation says that "If you implement a callback function, specified in the `lpfn` member of the `BROWSEINFO` structure, you receive a handle to the dialog box". That handle unlocks use of the entire Win32 API for customizations. – Ben Voigt Jun 25 '19 at 05:22
I was looking up how to do this, but largely had to figure it out on my own. I hope this saves anyone some time:
Above my main method, I put:
[DllImport("user32.dll", EntryPoint = "SetWindowText", CharSet = CharSet.Ansi)]
public static extern bool SetWindowText(IntPtr hWnd, String strNewWindowName);
[DllImport("user32.dll", EntryPoint = "FindWindow", CharSet = CharSet.Ansi)]
public static extern IntPtr FindWindow(string className, string windowName);
Since I know that the thread will pause while the dialog is shown, I created a new thread to check for that dialog window while it exists. Like so:
bool notfound = true;
new Thread(() => {
while (notfound)
{
//looks for a window with the title: "Browse For Folder"
IntPtr ptr = FindWindow(null, "Browse For Folder");
if (ptr != IntPtr.Zero)
{
//tells the while loop to stop checking
notfound = false;
//changes the title
SetWindowText(ptr, "Be happy!");
}
}
}).Start();
Then, I initiate the dialog:
using (var fbd = new FolderBrowserDialog())
{
DialogResult result = fbd.ShowDialog();
if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath))
{
//do stuff
}
}
This has worked for me, and it's not so complicated. Hope this helps anyone that might stumble on this page. By the way, remember that the thread must start before the dialog window is initiated, so that it can run and check for the window as soon as it exists.

- 27
- 2
-
1Just a couple of notes: (1) make sure the thread is created immediately before showing the dialog, as it'll max out a CPU core until it finds the dialog, and (2) be aware that this code only works in English - if you're running Windows in any other language, it will never find the dialog it's looking for, so it'll spin up a new thread each time you open a dialog and none of them will ever finish. – Anodyne Feb 15 '22 at 18:22