Browse for folder dialog

I have in several cases needed to allow a user to select a folder.  I was surprised to see that Microsoft did not have a browse for folder function in Codeunit 419.

I hereby suggest that Microsoft add this function to Codeunit 419.

[code] PROCEDURE BrowseForFolder@47(VAR FolderName@1000 : Text;Description@1001 : Text) : Boolean;
VAR
FolderBrowserDialog@1002 : DotNet "’System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′.System.Windows.Forms.FolderBrowserDialog" RUNONCLIENT;
DialagResult@1003 : DotNet "’System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′.System.Windows.Forms.DialogResult" RUNONCLIENT;
BEGIN
FolderBrowserDialog := FolderBrowserDialog.FolderBrowserDialog;
FolderBrowserDialog.Description := Description;
FolderBrowserDialog.SelectedPath := FolderName;
DialagResult := FolderBrowserDialog.ShowDialog;

IF DialagResult.CompareTo(DialagResult.OK) = 0 THEN BEGIN
FolderName := FolderBrowserDialog.SelectedPath;
EXIT(TRUE);
END;
EXIT(FALSE);
END;
[/code]

One Reply to “Browse for folder dialog”

  1. NAV2013 (versionlist : NAVW17.00.00.34902) has the function “BrowseForFolderDialog(WindowTitle : Text[50];DefaultFolderName : Text;ShowNewFolderButton : Boolean) : Text”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.