{"id":9136,"date":"2015-05-01T08:00:54","date_gmt":"2015-05-01T15:00:54","guid":{"rendered":"https:\/\/www.sapien.com\/blog\/?p=9136"},"modified":"2015-04-29T08:41:23","modified_gmt":"2015-04-29T15:41:23","slug":"powershell-studio-2015-new-folderbrowsermoderndialog-control","status":"publish","type":"post","link":"https:\/\/dev.sapien.com\/blog\/2015\/05\/01\/powershell-studio-2015-new-folderbrowsermoderndialog-control\/","title":{"rendered":"PowerShell Studio 2015 &#8211; New FolderBrowserModernDialog Control"},"content":{"rendered":"<p>With release of the v4.2.83 build of PowerShell Studio 2015, we introduced new features that we are covering in detail over a series of articles.<\/p>\n<p>This next new feature was also added in response to user feedback. This particular user wanted to use the modern version of the folder browser dialog that is available in the later versions of Windows. Unfortunately, the user had to manually add code to the form to accomplish this. Therefore we added a new control to our toolbox:<\/p>\n<p><strong>FolderBrowserModernDialog<\/strong><\/p>\n<p>This control will display the modern version of the <em>FolderBrowserDialog<\/em> on Windows 7 or greater:<\/p>\n<p><a href=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2015\/04\/SNAGHTMLdfc832.png\"><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; border-width: 0px;\" title=\"Modern Folder Browser\" src=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2015\/04\/SNAGHTMLdfc832_thumb.png\" alt=\"Modern Folder Browser\" width=\"244\" height=\"139\" border=\"0\" \/><\/a><\/p>\n<p>If running on a legacy OS, it will then display the original <em>FolderBrowserDialog<\/em>:<\/p>\n<p><a href=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2015\/04\/SNAGHTMLe10b79.png\"><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; border-width: 0px;\" title=\"Legacy Folder Browser\" src=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2015\/04\/SNAGHTMLe10b79_thumb.png\" alt=\"Legacy Folder Browser\" width=\"244\" height=\"229\" border=\"0\" \/><\/a><\/p>\n<p>You can find the new control in the ToolBox Panel:<\/p>\n<p><a href=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2015\/04\/image19.png\"><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; border-width: 0px;\" title=\"Toolbox\" src=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2015\/04\/image_thumb18.png\" alt=\"Toolbox\" width=\"244\" height=\"140\" border=\"0\" \/><\/a><\/p>\n<p>To add the dialog, simply drag and drop it into your existing form.<\/p>\n<p>The new <em>FolderBrowserModernDialog<\/em> has the following properties:<\/p>\n<p><a href=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2015\/04\/image20.png\"><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; border-width: 0px;\" title=\"Properties\" src=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2015\/04\/image_thumb19.png\" alt=\"Properties\" width=\"160\" height=\"244\" border=\"0\" \/><\/a><br \/>\n<em><strong>Title<\/strong><\/em><\/p>\n<p>This property sets the title of the folder browser dialog.<\/p>\n<p><em><strong>SelectedPath<\/strong><\/em><\/p>\n<p>This property sets the selected path of the dialog and returns the path the user selected.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Using the Dialog:<\/strong><\/p>\n<p>Here is an example of how to display the <em>FolderBrowserModernDialog <\/em>using its <em>ShowDialog<\/em> method:<\/p>\n<pre>    <span style=\"color: #8b0000;\">$folderbrowsermoderndialog1<\/span><span style=\"color: #000000;\">.SelectedPath <\/span><span style=\"color: #0000ff;\">=<\/span> <span style=\"color: #8b0000;\">$textboxPath<\/span><span style=\"color: #000000;\">.Text\r\n    <\/span><span style=\"color: #0000ff;\">if<\/span><span style=\"color: #000000;\"> (<\/span><span style=\"color: #8b0000;\">$folderbrowsermoderndialog1<\/span><span style=\"color: #000000;\">.ShowDialog() <\/span><span style=\"color: #0000ff;\">-eq<\/span> <span style=\"color: #ff0000;\">'OK'<\/span><span style=\"color: #000000;\">)\r\n    {\r\n        <\/span><span style=\"color: #8b0000;\">$textboxPath<\/span><span style=\"color: #000000;\">.Text <\/span><span style=\"color: #0000ff;\">=<\/span> <span style=\"color: #8b0000;\">$folderbrowsermoderndialog1<\/span><span style=\"color: #000000;\">.SelectedPath\r\n    }<\/span><\/pre>\n<p>&nbsp;<\/p>\n<p>The modern versions of the FolderBrowserDialog makes for a better user experience and we hope that your GUI users agree.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>With release of the v4.2.83 build of PowerShell Studio 2015, we introduced new features that we are covering in detail over a series of articles. This next new feature was also added in response to user feedback. This particular user wanted to use the modern version of the folder browser dialog that is available in [&hellip;]<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[703,632,25],"tags":[724,41,28,951,141,327],"class_list":["post-9136","post","type-post","status-publish","format-standard","hentry","category-powershell-studio","category-whats-new-software-news","category-windows-powershell","tag-control","tag-gui","tag-powershell","tag-powershell-studio-2015","tag-whats-new","tag-winform"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/9136","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/comments?post=9136"}],"version-history":[{"count":7,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/9136\/revisions"}],"predecessor-version":[{"id":9205,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/9136\/revisions\/9205"}],"wp:attachment":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/media?parent=9136"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/categories?post=9136"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/tags?post=9136"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}