How to chose file from filesystem?

I am creating import to the axapta 2012. I want to create button that open the form that will allow user to choose file from filesystem.

I find out simmilar function in WinApi for Folders. ::browseForFolderDialog

I find out something similar in USMF/Product information management/Common/Product configuration models “Import product model → File name” but I do not find how it works (yet).

The string with full path + file name is good enough result for me.

Anyone has some tips how to do this?

application = SysExcelApplication::construct(); workbooks = application.workbooks(); filename = “C:\Users\Rohit\Desktop\emp.xlsx”; // file path try { workbooks.open(filename); } catch (Exception::Error) { throw error(“File not found”); }

I do not want to set filename string in code. I want user to select existing file from filesystem.

I want something like filename = WinApi::SelectFile();

there is a standard form in AX tutorial_form_file check the method inside 2nd is tutorial_Table describtion check both you will get the idea…

Looking at tutorial_Form_File form is a good suggestion.

Don’t forget to implement fileNameLookup*() methods, otherwise you would get runtime errors when opening the file lookup.