Sample code for Dialogbox To choose a folder and filename

Hello all ,

Do anyone have a sample dialog box code to give a user control to select where they can choose their destination folder and also to give name for the filename ?

this is one of the sample i got from the internet :-

private void SetFolder()

{

filepath = WinAPI::browseForFolderDialog(“Description goes here”);

info(strFmt("The file path is %1 ",FilePath)); // To Display

}

how can i give the user control also to the change the filename to be save into the specific folder ?

hi jessica,

You have to add a stringEdit control to your DB Table and just to add “FilePath” EDT to extendeddatatype property of this control

add this column to form and see the form will provide you option to file path as image showing

2308.FilePath1.png

Also Add this to your form methods

str filePathLookupTitle()

{

return ‘Lookup Title: File Path’;

}

Rgds

BK


Don’t forget to “Verify Solution” if problem is solved !!

Hi,

A more simple way to do what you want:

static void jobToGetFilePath(Args _args)
{

dialog d;
Filename filename;
DialogField dialogFilename;

;

d = new dialog();
d.caption(“select a file”);
dialogFilename = d.addField(typeId(FilenameOpen));//add a field where you select your file in a specific path
d.run();//execute dialog

if(d.closedOk())
{
filename = dialogFileName.value();//return path file value

box::info(filename); //display path and file name

}

hope it helps, please verify solution if it solves your problem

regards,

Thomas

how to add an image to dialog

here what is res .dialog.addimage(int res).

You can look at this job.

http://axdeveloper.wordpress.com/2014/05/08/lesson49-dialog-3/

Hi, Sharma.

In AX 2012 it not works. FileNameOpen - all ok, FilePath - pressing button does nothing.

As already said, you need to have filePathLookupTitle method on form.

look at \Forms\DocuParameters\Methods\filePathLookupTitle