What are folderbrowser flags in Windows Forms Folder Browser

Flags can be used to set various styles for the FolderBrowser Dialog. Each style has it’s own behavior and these styles can be added or removed to get the desired style for the FolderBrowser Dialog.

Look at the below given snippet to apply “RestrictToSubfolders” style and to remove the “ShowTextBox” style for the FolderBrowser Dialog.

this.folderBrowser1.Style &= ~FolderBrowserStyles.RestrictToSubfolders;

this.folderBrowser1.Style |= FolderBrowserStyles.ShowTextBox;
Me.folderBrowser1.Style = Me.folderBrowser1.Style And Not FolderBrowserStyles.RestrictToSubfolders

Me.folderBrowser1.Style = Me.folderBrowser1.Style Or FolderBrowserStyles.ShowTextBox