Hi,
Browse folder in classic version using automation
Browse folder in RTC version using DotNet Variable:
Browse folder in classic version using automation
- It is look like as below
ExpMgt_lCdu.SelectFolderClassic_gFnc("Export Directory");
IF ISCLEAR(WindowsShell_lAut) THEN
IF NOT CREATE(WindowsShell_lAut) THEN
EXIT;
SelectedFolder_lAut := WindowsShell_lAut.BrowseForFolder(0,FolderName_vTxt,1,'');
IF NOT ISCLEAR(SelectedFolder_lAut) THEN BEGIN
FolderItem_lAut := SelectedFolder_lAut.Self;
IF FolderItem_lAut.Path <> '' THEN
FolderName_vTxt := FolderItem_lAut.Path;
END;
Name
|
DataType
|
Subtype
|
Length
|
WindowsShell_lAut
|
Automation
|
'Microsoft
Shell Controls And Automation'.Shell
|
|
SelectedFolder_lAut
|
Automation
|
'Microsoft
Shell Controls And Automation'.Folder2
|
|
FolderItem_lAut
|
Automation
|
'Microsoft
Shell Controls And Automation'.FolderItem
|
Done !!
Browse folder in RTC version using DotNet Variable:
- It is look like
FolderBrowser_lDnt := FolderBrowser_lDnt.FolderBrowserDialog();
FolderBrowser_lDnt.ShowNewFolderButton := TRUE;
FolderBrowser_lDnt.Description := Text000_gCtx;
FolderBrowser_lDnt.ShowDialog();
IF FolderBrowser_lDnt.SelectedPath <> '' THEN
FolderName_vTxt := FolderBrowser_lDnt.SelectedPath;
Name
|
DataType
|
Subtype
|
FolderBrowser_lDnt
|
DotNet
|
'System.Windows.Forms,
Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089'.System.Windows.Forms.FolderBrowserDialog
|
- Create one Text Constant use in above code
Name
|
ConstValue
|
Text000_gCtx
|
Select a Folder...
|
Done !!
Easy Peasy with your guide. Thanks for that. Maybe good to mention that you might need to change the RunOnClient property of the dotnet variable to Yes in order to prevent error: This message is for C/AL programmers: A call to System.Windows.Forms.FolderBrowserDialog.ShowDialog failed with this message: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
ReplyDeleteThank you Nilesh. You're the best ! :D
ReplyDelete